Bug 1459931

Summary: hammer repository update missing organization-id and organization options
Product: Red Hat Satellite Reporter: Djebran Lezzoum <dlezzoum>
Component: RepositoriesAssignee: Brad Buckingham <bbuckingham>
Status: CLOSED ERRATA QA Contact: Nikhil Kathole <nkathole>
Severity: high Docs Contact:
Priority: medium    
Version: 6.3.0CC: bbuckingham, bkearney, dhlavacd, ehelms, mhulan, nkathole, tstrachota
Target Milestone: UnspecifiedKeywords: Regression, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: tfm-rubygem-hammer_cli_katello-0.10.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:51:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Djebran Lezzoum 2017-06-08 15:24:06 UTC
Description of problem:
hammer repository update missing  organization-id and organization options

Version-Release number of selected component (if applicable):
* candlepin-2.0.35-1.el7.noarch
* candlepin-selinux-2.0.35-1.el7.noarch
* foreman-1.15.0-1.el7sat.noarch
* foreman-cli-1.15.0-1.el7sat.noarch
* foreman-compute-1.15.0-1.el7sat.noarch
* foreman-debug-1.15.0-1.el7sat.noarch
* foreman-discovery-image-3.1.1-22.el7sat.noarch
* foreman-ec2-1.15.0-1.el7sat.noarch
* foreman-gce-1.15.0-1.el7sat.noarch
* foreman-installer-1.15.0-1.el7sat.noarch
* foreman-installer-katello-3.4.0.1-1.el7sat.noarch
* foreman-libvirt-1.15.0-1.el7sat.noarch
* foreman-openstack-1.15.0-1.el7sat.noarch
* foreman-ovirt-1.15.0-1.el7sat.noarch
* foreman-postgresql-1.15.0-1.el7sat.noarch
* foreman-proxy-1.15.0-2.el7sat.noarch
* foreman-rackspace-1.15.0-1.el7sat.noarch
* foreman-selinux-1.15.0-1.el7sat.noarch
* foreman-vmware-1.15.0-1.el7sat.noarch
* katello-3.4.0-3.el7sat.noarch
* katello-ca-consumer-sat-r220-02.lab.eng.rdu2.redhat.com-1.0-1.noarch
* katello-certs-tools-2.4.0-1.el7sat.noarch
* katello-client-bootstrap-1.3.0-1.el7sat.noarch
* katello-common-3.4.0-3.el7sat.noarch
* katello-debug-3.4.0-3.el7sat.noarch
* katello-default-ca-1.0-1.noarch
* katello-installer-base-3.4.0.1-1.el7sat.noarch
* katello-selinux-3.0.2-1.el7sat.noarch
* katello-server-ca-1.0-1.noarch
* katello-service-3.4.0-3.el7sat.noarch
* openldap-2.4.40-13.el7.x86_64
* pulp-client-1.0-1.noarch
* pulp-docker-plugins-2.3.0-1.el7sat.noarch
* pulp-katello-1.0.2-1.el7sat.noarch
* pulp-ostree-plugins-1.2.1-1.el7sat.noarch
* pulp-puppet-plugins-2.12.2-1.el7sat.noarch
* pulp-puppet-tools-2.12.2-1.el7sat.noarch
* pulp-rpm-plugins-2.12.2-1.el7sat.noarch
* pulp-selinux-2.12.2-1.el7sat.noarch
* pulp-server-2.12.2-1.el7sat.noarch
* python-ldap-2.4.15-2.el7.x86_64
* tfm-rubygem-ldap_fluff-0.4.6-1.el7sat.noarch
* tfm-rubygem-net-ldap-0.15.0-1.el7sat.noarch

How reproducible:
Always

Steps to Reproduce:
1. create a repository 
2. update the repository with hammer cli
   hammer repository update --organization-id="org_id" --id="repo_id" --gpg-key-id="gpg_key_id" 
3.

Actual results:
Error: Unrecognised option '--organization-id'

See: 'hammer repository update --help'
Could not update the repository:
  Error: Unrecognised option '--organization-id'
  
  See: 'hammer repository update --help'

Clamp::UsageError (Unrecognised option '--organization-id'):
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/option/parsing.rb:62:in `find_option'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/option/parsing.rb:28:in `parse_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:53:in `parse'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.0/lib/hammer_cli/abstract.rb:35:in `parse'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:67:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.0/lib/hammer_cli/abstract.rb:27:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.0/lib/hammer_cli/abstract.rb:27:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.0/lib/hammer_cli/abstract.rb:27:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.0/bin/hammer:146:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'


Expected results:
repository successfully updated

Additional info:
help command does not show organization and organization-id as options
hammer repository update --help
Usage:
    hammer repository update [OPTIONS]

Options:
 --checksum-type CHECKSUM_TYPE                             checksum of the repository, currently 'sha1' & 'sha256'
                                                           are supported.'
 --docker-upstream-name DOCKER_UPSTREAM_NAME               name of the upstream docker repository
 --download-policy DOWNLOAD_POLICY                         download policy for yum repos (either 'immediate',
                                                           'on_demand', or 'background')
                                                           Possible value(s): 'immediate', 'on_demand', 'background'
 --gpg-key GPG_KEY_NAME                                    Name to search by
 --gpg-key-id GPG_KEY_ID                                   gpg key numeric identifier
 --id ID                                                   repository ID
 --mirror-on-sync MIRROR_ON_SYNC                           true if this repository when synced has to be mirrored from the source and
                                                           stale rpms removed.
                                                           One of true/false, yes/no, 1/0.
 --name NAME                                               Repository name to search by
 --new-name NEW_NAME                                       New name for the repository
 --ostree-upstream-sync-depth OSTREE_UPSTREAM_SYNC_DEPTH   if a custom sync policy is chosen for ostree repositories then a
                                                           'depth' value must be provided.
 --ostree-upstream-sync-policy OSTREE_UPSTREAM_SYNC_POLICY policies for syncing upstream ostree repositories.
                                                           Possible value(s): 'latest', 'all', 'custom'
 --product PRODUCT_NAME                                    Product name to search by
 --product-id PRODUCT_ID                                   product numeric identifier
 --publish-via-http ENABLE                                 Publish Via HTTP
                                                           One of true/false, yes/no, 1/0.
 --upstream-password UPSTREAM_PASSWORD                     Password of the upstream repository user for authentication
 --upstream-username UPSTREAM_USERNAME                     Username of the upstream repository user for authentication
 --url URL                                                 the feed url of the original repository
 --verify-ssl-on-sync VERIFY_SSL_ON_SYNC                   if true, Katello will verify the upstream url's SSL certifcates are
                                                           signed by a trusted CA.
                                                           One of true/false, yes/no, 1/0.
 -h, --help                                                print help

Comment 3 Brad Buckingham 2017-06-13 10:50:44 UTC
With the latest upstream katello 3.4 builds below, I do see the --organization
and --organization-id parameters; therefore, going to move this to POST for
verification with the next build.

    tfm-rubygem-katello-3.4.0.2-2.el7.noarch
    tfm-rubygem-hammer_cli_katello-0.10.0-1.el7.noarch

hammer> repository update --organization-id 1 --id 2 --new-name custom-updated
Repository updated

hammer> repository update --help
Usage:
     repository update [OPTIONS]

Options:
 --checksum-type CHECKSUM_TYPE                             checksum of the repository, currently 'sha1' & 'sha256'
                                                           are supported.'
 --docker-upstream-name DOCKER_UPSTREAM_NAME               name of the upstream docker repository
 --download-policy DOWNLOAD_POLICY                         download policy for yum repos (either 'immediate',
                                                           'on_demand', or 'background')
                                                           Possible value(s): 'immediate', 'on_demand', 'background'
 --gpg-key GPG_KEY_NAME                                    Name to search by
 --gpg-key-id GPG_KEY_ID                                   gpg key numeric identifier
 --id ID                                                   repository ID
 --mirror-on-sync MIRROR_ON_SYNC                           true if this repository when synced has to be mirrored from the source and
                                                           stale rpms removed.
                                                           One of true/false, yes/no, 1/0.
 --name NAME                                               Repository name to search by
 --new-name NEW_NAME                                       New name for the repository
 --organization ORGANIZATION_NAME                          Organization name to search by
 --organization-id ORGANIZATION_ID                         Organization ID to search by
 --organization-label ORGANIZATION_LABEL                   Organization label to search by
 --ostree-upstream-sync-depth OSTREE_UPSTREAM_SYNC_DEPTH   if a custom sync policy is chosen for ostree repositories then a
                                                           'depth' value must be provided.
 --ostree-upstream-sync-policy OSTREE_UPSTREAM_SYNC_POLICY policies for syncing upstream ostree repositories.
                                                           Possible value(s): 'latest', 'all', 'custom'
 --product PRODUCT_NAME                                    Product name to search by
 --product-id PRODUCT_ID                                   product numeric identifier
 --publish-via-http ENABLE                                 Publish Via HTTP
                                                           One of true/false, yes/no, 1/0.
 --upstream-password UPSTREAM_PASSWORD                     Password of the upstream repository user for authentication
 --upstream-username UPSTREAM_USERNAME                     Username of the upstream repository user for authentication
 --url URL                                                 the feed url of the original repository
 --verify-ssl-on-sync VERIFY_SSL_ON_SYNC                   if true, Katello will verify the upstream url's SSL certifcates are
                                                           signed by a trusted CA.
                                                           One of true/false, yes/no, 1/0.
 -h, --help                                                print help
hammer>

Comment 4 Nikhil Kathole 2017-08-22 07:39:10 UTC
VERIFIED

Version Tested:
Satellite-6.3 Snap 12

steps:
1. Created a repository
2. hammer repository update --help
>>> 

Usage:
    hammer repository update [OPTIONS]

Options:
 --checksum-type CHECKSUM_TYPE                             checksum of the repository, currently 'sha1' & 'sha256'
                                                           are supported.'
 --docker-upstream-name DOCKER_UPSTREAM_NAME               name of the upstream docker repository
 --download-policy DOWNLOAD_POLICY                         download policy for yum repos (either 'immediate',
                                                           'on_demand', or 'background')
                                                           Possible value(s): 'immediate', 'on_demand', 'background'
 --gpg-key GPG_KEY_NAME                                    Name to search by
 --gpg-key-id GPG_KEY_ID                                   gpg key numeric identifier
 --id ID                                                   repository ID
 --mirror-on-sync MIRROR_ON_SYNC                           true if this repository when synced has to be mirrored from the source and
                                                           stale rpms removed.
                                                           One of true/false, yes/no, 1/0.
 --name NAME                                               Repository name to search by
 --new-name NEW_NAME                                       New name for the repository
 --organization ORGANIZATION_NAME                          Organization name to search by
 --organization-id ORGANIZATION_ID                         Organization ID to search by
 --organization-label ORGANIZATION_LABEL                   Organization label to search by
 --ostree-upstream-sync-depth OSTREE_UPSTREAM_SYNC_DEPTH   if a custom sync policy is chosen for ostree repositories then a
                                                           'depth' value must be provided.
 --ostree-upstream-sync-policy OSTREE_UPSTREAM_SYNC_POLICY policies for syncing upstream ostree repositories.
                                                           Possible value(s): 'latest', 'all', 'custom'
 --product PRODUCT_NAME                                    Product name to search by
 --product-id PRODUCT_ID                                   product numeric identifier
 --publish-via-http ENABLE                                 Publish Via HTTP
                                                           One of true/false, yes/no, 1/0.
 --upstream-password UPSTREAM_PASSWORD                     Password of the upstream repository user for authentication
 --upstream-username UPSTREAM_USERNAME                     Username of the upstream repository user for authentication
 --url URL                                                 the feed url of the original repository
 --verify-ssl-on-sync VERIFY_SSL_ON_SYNC                   if true, Katello will verify the upstream url's SSL certifcates are
                                                           signed by a trusted CA.
                                                           One of true/false, yes/no, 1/0.
 -h, --help                                                print help

3. hammer repository info --product Sat6Tools7 --name sat6tool7 --organization-id 1

>>>

ID:                 6
Name:               sat6tool7
Label:              sat6tool7
Organization:       Default Organization
Red Hat Repository: no
Content Type:       yum
Checksum Type:      sha256
Mirror on Sync:     yes
URL:                http://url/repos
Publish Via HTTP:   yes
Published At:       http://$HOST/pulp/repos/Default_Organization/Library/custom/Sat6Tools7/sat6tool7/
Relative Path:      Default_Organization/Library/custom/Sat6Tools7/sat6tool7
Download Policy:    immediate
Product:
    ID:   39
    Name: Sat6Tools7
GPG Key:

Sync:
    Status:         Success
    Last Sync Date: 1 days
Created:            2017/08/16 12:01:25
Updated:            2017/08/16 12:01:49
Content Counts:
    Packages:       62
    Package Groups: 1
    Errata:         0

4. hammer repository update --organization-id 1 --id 6 --new-name new-updated
>>>
Repository updated

5. hammer repository info --product Sat6Tools7 --id 6 --organization-id 1
>>>
ID:                 6
Name:               new-updated
Label:              sat6tool7
Organization:       Default Organization
Red Hat Repository: no
Content Type:       yum
Checksum Type:      sha256
Mirror on Sync:     yes
URL:                http://url/repos/
Publish Via HTTP:   yes
Published At:       http://$HOST/pulp/repos/Default_Organization/Library/custom/Sat6Tools7/sat6tool7/
Relative Path:      Default_Organization/Library/custom/Sat6Tools7/sat6tool7
Download Policy:    immediate
Product:
    ID:   39
    Name: Sat6Tools7
GPG Key:

Sync:
    Status:         Success
    Last Sync Date: 1 days
Created:            2017/08/16 12:01:25
Updated:            2017/08/22 06:16:32
Content Counts:
    Packages:       62
    Package Groups: 1
    Errata:         0

Comment 5 Satellite Program 2018-02-21 16:51:07 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.
> 
> For information on the advisory, and where to find the updated files, follow the link below.
> 
> If the solution does not work for you, open a new bug report.
> 
> https://access.redhat.com/errata/RHSA-2018:0336