Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1023147

Summary: [RFE] hammer: proxy create/update should provide option to associate Orgs
Product: Red Hat Satellite Reporter: Corey Welton <cwelton>
Component: HammerAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: NightlyCC: dcleal, ohadlevy, tstrachota
Target Milestone: UnspecifiedKeywords: FutureFeature, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/3497
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-09 15:23:52 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 Corey Welton 2013-10-24 17:33:52 UTC
Description of problem:
In the UI, we can associate organization with a proxy.  There does not appear to be a way to do that in the CLI, however.  Would be nice to have.


Something like

hammer -u admin -p admin proxy create --name foobar --url https://example.com:9090 --add_org org_name
hammer -u admin -p admin proxy create --name foobar --url https://example.com:9090 --remove_org org_name
hammer -u admin -p admin proxy update --name foobar --remove_org org_name
hammer -u admin -p admin proxy update --name foobar --remove_org org_name

and even possibly comma-separated, e.g., 

--add_org NorthAmerica,EMEA,APAC

Version-Release number of selected component (if applicable):
Satellite-6.0.2-RHEL-6-20131023.1

Comment 2 Dominic Cleal 2013-10-25 11:09:39 UTC
It's possible to do this today via the organization subcommand, rather than the command for the resource you're associating, though I did just hit another bug while attempting it (http://projects.theforeman.org/issues/3499).

Something like "hammer organization add_smartproxy ..." should work.

Filed this as a feature too though, you should be able to do it at resource creation.

Comment 5 Bryan Kearney 2015-08-25 17:22:52 UTC
Upstream bug component is Hammer

Comment 6 Bryan Kearney 2016-08-10 18:14:28 UTC
Upstream bug component is Uncategorized

Comment 7 Bryan Kearney 2016-08-10 18:59:35 UTC
Upstream bug component is Hammer

Comment 8 Tomas Strachota 2016-11-09 15:23:52 UTC
Fixed in satellite 6.2, hammer provides association options/commands for proxies that are consistent with other resources:

[root@sat62 ~]# hammer proxy create -h
Usage:
    hammer proxy create [OPTIONS]

Options:
 --location-ids LOCATION_IDS         REPLACE locations with given ids
                                     Comma separated list of values.
 --locations LOCATION_NAMES          Comma separated list of values.
 --name NAME                          
 --organization-ids ORGANIZATION_IDS REPLACE organizations with given ids.
                                     Comma separated list of values.
 --organizations ORGANIZATION_NAMES  Comma separated list of values.
 --url URL                            
 -h, --help                          print help
[root@sat62 ~]# hammer proxy update -h
Usage:
    hammer proxy update [OPTIONS]

Options:
 --id ID                              
 --location-ids LOCATION_IDS         REPLACE locations with given ids
                                     Comma separated list of values.
 --locations LOCATION_NAMES          Comma separated list of values.
 --name NAME                         Name to search by
 --new-name NEW_NAME                  
 --organization-ids ORGANIZATION_IDS REPLACE organizations with given ids.
                                     Comma separated list of values.
 --organizations ORGANIZATION_NAMES  Comma separated list of values.
 --url URL                            
 -h, --help                          print help
[root@sat62 ~]# hammer organization -h | grep proxy
 add-smart-proxy               Associate a smart proxy
 remove-smart-proxy            Disassociate a smart proxy


[root@sat62 ~]# hammer --version
hammer (0.5.1.11)
 * hammer_cli_csv (unknown version)
 * hammer_cli_foreman (0.5.1.9)
 * hammer_cli_foreman_admin (0.0.5)
 * hammer_cli_foreman_bootdisk (0.1.3.3)
 * hammer_cli_foreman_discovery (0.0.2.3)
 * hammer_cli_foreman_docker (unknown version)
 * hammer_cli_foreman_remote_execution (unknown version)
 * hammer_cli_foreman_tasks (unknown version)
 * hammer_cli_import (0.11.2)
 * hammer_cli_katello (0.0.22.26)