Bug 1146687 - Updating a distributors config does not accept null values
Summary: Updating a distributors config does not accept null values
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Pulp
Classification: Retired
Component: API/integration
Version: 2.4.1
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: ---
: ---
Assignee: Jeremy Cline
QA Contact: Irina Gulina
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-25 18:38 UTC by Justin Sherrill
Modified: 2015-02-28 22:22 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-28 22:22:46 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Pulp Redmine 546 0 None None None Never

Description Justin Sherrill 2014-09-25 18:38:09 UTC
Description of problem:

It appears that updating a distributors config does not let you set 'null' values for things that make sense, such as the checksum_type on a yum_distributor.  I may want to set it back to the default value, but can't seem to do that.


Version-Release number of selected component (if applicable):
2.4.1

How reproducible:
Always

Steps to Reproduce:
1. Attempt to update a distributor's checksum back to the default value of null

Actual results:
Doesn't get updated

Expected results:
Should be updated

Additional info:
the call in question:
PUT /pulp/api/v2/repositories/Default_Organization-testproduct-sha256/distributors/Default_Organization-testproduct-sha256//

{"distributor_config":{"relative_url":"Default_Organization/Library/custom/testproductsha256","http":true,"https":true,"protected":true,"checksum_type":null}},

Comment 1 Michael Hrivnak 2014-09-26 14:35:11 UTC
To rephrase, I think the desire is to unset a value in the config. From pulp's internal perspective, the best behavior would be to remove the key and value from the config object.

Comment 2 Jeremy Cline 2014-12-03 21:44:11 UTC
I wasn't able to reproduce this on 2.4.3 or the current 2.6 development branch, but I'm going to put in ON_QA just to make sure.

Comment 3 Irina Gulina 2014-12-11 13:58:21 UTC
Couldn't reproduce it on 2.4.4, 2.5.1 and 2.6

>> rpm -qa | grep pulp-server
pulp-server-2.6.0-0.1.alpha.fc20.noarch

>> curl -k -X GET https://user:pass@host/pulp/api/v2/repositories/my_repo/distributors/ | python -m json.tool  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   678  100   678    0     0   1719      0 --:--:-- --:--:-- --:--:--  1720
[
    {
        "_id": {
            "$oid": "54898d2799cca8476f397d5b"
        },
        "_ns": "repo_distributors",
        "auto_publish": true,
        "config": {
            "checksum_type": "sha",
            "http": true,
            "https": true,
            "protected": true,
            "relative_url": "my_updated_repo"
        },
        "distributor_type_id": "yum_distributor",
        "id": "yum_distributor",
        "last_publish": null,
        "repo_id": "my_repo",
        "scheduled_publishes": [],
        "scratchpad": null
    },
    {
        "_id": {
            "$oid": "54898d2799cca8476f397d5c"
        },
        "_ns": "repo_distributors",
        "auto_publish": false,
        "config": {
            "http": false,
            "https": true
        },
        "distributor_type_id": "export_distributor",
        "id": "export_distributor",
        "last_publish": null,
        "repo_id": "my_repo",
        "scheduled_publishes": [],
        "scratchpad": null
    }
]


>> curl -i -H "Accept: application/json" -X PUT  -k https://user:pass@host/pulp/api/v2/repositories/my_repo/distributors/yum_distributor/ --data '{"distributor_config":{"relative_url":"my_updated_repo","http":true,"https":true,"protected":true,"checksum_type": null}}'

HTTP/1.1 202 Accepted
Date: Thu, 11 Dec 2014 13:11:31 GMT
Server: Apache/2.4.10 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.5 Python/2.7.5
Content-Encoding: utf-8
Content-Length: 172
Content-Type: application/json

{"spawned_tasks": [{"_href": "/pulp/api/v2/tasks/43ecefe5-1dbc-4080-9dc4-0c7ede5720d5/", "task_id": "43ecefe5-1dbc-4080-9dc4-0c7ede5720d5"}], "result": null, "error": null}

>> curl -k -X GET https://user:pass@host/pulp/api/v2/repositories/my_repo/distributors/ | python -m json.tool  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   654  100   654    0     0   1931      0 --:--:-- --:--:-- --:--:--  1929
[
    {
        "_id": {
            "$oid": "54898d2799cca8476f397d5b"
        },
        "_ns": "repo_distributors",
        "auto_publish": true,
        "config": {
            "http": true,
            "https": true,
            "protected": true,
            "relative_url": "my_updated_repo"
        },
        "distributor_type_id": "yum_distributor",
        "id": "yum_distributor",
        "last_publish": null,
        "repo_id": "my_repo",
        "scheduled_publishes": [],
        "scratchpad": null
    },
    {
        "_id": {
            "$oid": "54898d2799cca8476f397d5c"
        },
        "_ns": "repo_distributors",
        "auto_publish": false,
        "config": {
            "http": false,
            "https": true
        },
        "distributor_type_id": "export_distributor",
        "id": "export_distributor",
        "last_publish": null,
        "repo_id": "my_repo",
        "scheduled_publishes": [],
        "scratchpad": null
    }
]

------------------------------------------------------------------------

>> rpm -qa | grep pulp-server
pulp-server-2.5.1-0.1.beta.el6.noarch

>> curl -k -X GET https://user:pass@host/pulp/api/v2/repositories/kik-repo/distributors/ | python -m json.tool

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
115   691  115   691    0     0   2138      0 --:--:-- --:--:-- --:--:--  4213
[
    {
        "_id": {
            "$oid": "5488787dcf3e2224f90b7eba"
        }, 
        "_ns": "repo_distributors", 
        "auto_publish": true, 
        "config": {
            "checksum_type": "sha", 
            "http": true, 
            "https": true, 
            "protected": true, 
            "relative_url": "kik-repo"
        }, 
        "distributor_type_id": "yum_distributor", 
        "id": "yum_distributor", 
        "last_publish": "2014-12-10T16:54:34Z", 
        "repo_id": "kik-repo", 
        "scheduled_publishes": [], 
        "scratchpad": null
    }, 
    {
        "_id": {
            "$oid": "5488787dcf3e2224f90b7ebb"
        }, 
        "_ns": "repo_distributors", 
        "auto_publish": false, 
        "config": {
            "http": false, 
            "https": true
        }, 
        "distributor_type_id": "export_distributor", 
        "id": "export_distributor", 
        "last_publish": null, 
        "repo_id": "kik-repo", 
        "scheduled_publishes": [], 
        "scratchpad": null
    }
]

>> curl -i -H "Accept: application/json" -X PUT  -k https://user:pass@host/pulp/api/v2/repositories/kik-repo/distributors/yum_distributor/ --data '{"distributor_config":{"relative_url":"kik-repo","http":true,"https":true,"protected":true,"checksum_type": null}}'

HTTP/1.1 202 Accepted
Date: Thu, 11 Dec 2014 13:26:23 GMT
Server: Apache/2.2.15 (Red Hat)
Content-Encoding: utf-8
Content-Length: 172
Connection: close
Content-Type: application/json

{"spawned_tasks": [{"_href": "/pulp/api/v2/tasks/770f71ec-4fd7-46aa-ad9e-8f71363f0ade/", "task_id": "770f71ec-4fd7-46aa-ad9e-8f71363f0ade"}], "result": null, "error": null}

>>  curl -k -X GET https://user:pass@host/pulp/api/v2/repositories/kik-repo/distributors/ | python -m json.tool  

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
111   667  111   667    0     0   2503      0 --:--:-- --:--:-- --:--:--  4042
[
    {
        "_id": {
            "$oid": "5488787dcf3e2224f90b7eba"
        }, 
        "_ns": "repo_distributors", 
        "auto_publish": true, 
        "config": {
            "http": true, 
            "https": true, 
            "protected": true, 
            "relative_url": "kik-repo"
        }, 
        "distributor_type_id": "yum_distributor", 
        "id": "yum_distributor", 
        "last_publish": "2014-12-10T16:54:34Z", 
        "repo_id": "kik-repo", 
        "scheduled_publishes": [], 
        "scratchpad": null
    }, 
    {
        "_id": {
            "$oid": "5488787dcf3e2224f90b7ebb"
        }, 
        "_ns": "repo_distributors", 
        "auto_publish": false, 
        "config": {
            "http": false, 
            "https": true
        }, 
        "distributor_type_id": "export_distributor", 
        "id": "export_distributor", 
        "last_publish": null, 
        "repo_id": "kik-repo", 
        "scheduled_publishes": [], 
        "scratchpad": null
    }
]

----------------------------------------------------------------------------

>> rpm -qa | grep pulp-server
pulp-server-2.4.4-0.1.beta.el7.noarch

>> curl -k -X GET https://user:pass@host/pulp/api/v2/repositories/sha-yum/distributors/ | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   678  100   678    0     0   1418      0 --:--:-- --:--:-- --:--:--  1418
[
    {
        "_id": {
            "$oid": "5485d22821ede1283eb23631"
        },
        "_ns": "repo_distributors",
        "auto_publish": true,
        "config": {
            "checksum_type": "sha256",
            "http": false,
            "https": true,
            "relative_url": "sha-yum"
        },
        "distributor_type_id": "yum_distributor",
        "id": "yum_distributor",
        "last_publish": "2014-12-08T11:32:28-05:00",
        "repo_id": "sha-yum",
        "scheduled_publishes": [],
        "scratchpad": null
    },
    {
        "_id": {
            "$oid": "5485d22821ede1283eb23632"
        },
        "_ns": "repo_distributors",
        "auto_publish": false,
        "config": {
            "http": false,
            "https": true
        },
        "distributor_type_id": "export_distributor",
        "id": "export_distributor",
        "last_publish": null,
        "repo_id": "sha-yum",
        "scheduled_publishes": [],
        "scratchpad": null
    }
]

>> curl -i -H "Accept: application/json" -X PUT  -k https://user:pass@host/pulp/api/v2/repositories/sha-yum/distributors/yum_distributor/ --data '{"distributor_config":{"relative_url":"sha-yum","http":true,"https":true,"protected":true,"checksum_type": null}}'


HTTP/1.1 202 Accepted
Date: Thu, 11 Dec 2014 13:31:49 GMT
Server: Apache/2.4.6 (Red Hat) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Content-Encoding: utf-8
Content-Length: 172
Content-Type: application/json

{"spawned_tasks": [{"_href": "/pulp/api/v2/tasks/53a160f3-f579-49bb-b7a4-e85549f0601d/", "task_id": "53a160f3-f579-49bb-b7a4-e85549f0601d"}], "result": null, "error": null}

>> curl -k -X GET https://user:pass@host/pulp/api/v2/repositories/sha-yum/distributors/ | python -m json.tool  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   669  100   669    0     0   1442      0 --:--:-- --:--:-- --:--:--  1444
[
    {
        "_id": {
            "$oid": "5485d22821ede1283eb23631"
        },
        "_ns": "repo_distributors",
        "auto_publish": true,
        "config": {
            "http": true,
            "https": true,
            "protected": true,
            "relative_url": "sha-yum"
        },
        "distributor_type_id": "yum_distributor",
        "id": "yum_distributor",
        "last_publish": "2014-12-08T11:32:28-05:00",
        "repo_id": "sha-yum",
        "scheduled_publishes": [],
        "scratchpad": null
    },
    {
        "_id": {
            "$oid": "5485d22821ede1283eb23632"
        },
        "_ns": "repo_distributors",
        "auto_publish": false,
        "config": {
            "http": false,
            "https": true
        },
        "distributor_type_id": "export_distributor",
        "id": "export_distributor",
        "last_publish": null,
        "repo_id": "sha-yum",
        "scheduled_publishes": [],
        "scratchpad": null
    }
]

Comment 4 Brian Bouterse 2015-02-28 22:22:46 UTC
Moved to https://pulp.plan.io/issues/546


Note You need to log in before you can comment on or make changes to this bug.