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 1366437

Summary: need way to attach a subscription to a content host w/ hammer
Product: Red Hat Satellite Reporter: Mike McCune <mmccune>
Component: Hammer - ContentAssignee: Partha Aji <paji>
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: high Docs Contact:
Priority: high    
Version: 6.2.0CC: bbuckingham, bkearney, cwelton, dlezzoum, egolov, jcallaha, jean-pierre.pitout, katello-qa-list, ktordeur, mlele, paji, rjerrido, syangsao, tomckay, xdmoon
Target Milestone: UnspecifiedKeywords: PrioBumpField, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/9669
Whiteboard:
Fixed In Version: rubygem-hammer_cli_katello-0.0.22.26-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1199515 Environment:
Last Closed: 2016-09-15 06:21:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1199515    
Bug Blocks:    

Comment 3 Bryan Kearney 2016-08-12 02:16:48 UTC
Upstream bug assigned to paji

Comment 4 Bryan Kearney 2016-08-12 02:16:52 UTC
Upstream bug component is Hammer - Content

Comment 5 Bryan Kearney 2016-08-12 02:16:56 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/9669 has been closed

Comment 8 jcallaha 2016-09-01 18:15:50 UTC
Verified in Satellite 6.2.2. There are a number of options available under: host subscription. See below

[root@rhsm-qe-1 ~]# hammer host subscription --help
Usage:
    hammer host subscription [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:
 SUBCOMMAND                    subcommand
 [ARG] ...                     subcommand arguments

Subcommands:
 attach                        Add a subscription to a host
 auto-attach                   Trigger an auto-attach of subscriptions
 register                      Register a host with subscription and information.
 remove                         
 unregister                    Unregister the host as a subscription consume

[root@rhsm-qe-1 ~]# hammer host subscription attach --help
Usage:
    hammer host subscription attach [OPTIONS]

Options:
 --host HOST_NAME                  Name to search by
 --host-id HOST_ID                  
 --quantity Quantity               Quantity of this subscriptions to add. Defaults to 1
 --subscription-id SUBSCRIPTION_ID ID of subscription
 -h, --help                        print help

[root@rhsm-qe-1 ~]# hammer host subscription attach --subscription-id 4 --host fake1
Subscription attached to the host successfully

[root@rhsm-qe-1 ~]# hammer host subscription auto-attach --help
Usage:
    hammer host subscription auto-attach [OPTIONS]

Options:
 --host HOST_NAME              Name to search by
 --host-id HOST_ID              
 -h, --help                    print help

[root@rhsm-qe-1 ~]# hammer host subscription auto-attach --host fake1
Auto attached subscriptions to the host successfully

[root@rhsm-qe-1 ~]# hammer host subscription register --help
Usage:
    hammer host subscription register [OPTIONS]

Options:
 --content-view CONTENT_VIEW_NAME                    Content view name to search by
 --content-view-id CONTENT_VIEW_ID                   content view numeric identifier
 --hypervisor-guest-uuids HYPERVISOR_GUEST_UUIDS     UUIDs of the virtual guests from the host's hypervisor
                                                     Comma separated list of values.
 --lifecycle-environment LIFECYCLE_ENVIRONMENT_NAME  Lifecycle environment name to search by
 --lifecycle-environment-id LIFECYCLE_ENVIRONMENT_ID ID of the environment
 --name NAME                                         Name of the host
 --organization ORGANIZATION_NAME                    Organization name to search by
 --organization-id ORGANIZATION_ID                   organization ID
 --organization-label ORGANIZATION_LABEL             Organization label to search by
 --release-version RELEASE_VERSION                   Release version of the content host
 --service-level SERVICE_LEVEL                       A service level for auto-healing process, e.g. SELF-SUPPORT
 --uuid UUID                                         UUID to use for registered host, random uuid is generated if not provided
 -h, --help                                          print help

[root@rhsm-qe-1 ~]# hammer host subscription remove --help
Usage:
    hammer host subscription remove [OPTIONS]

Options:
 --host HOST_NAME                  Name to search by
 --host-id HOST_ID                  
 --quantity Quantity               Remove the first instance of a subscription with matching id and quantity
 --subscription-id SUBSCRIPTION_ID ID of subscription
 -h, --help                        print help

[root@rhsm-qe-1 ~]# hammer host subscription unregister --help
Usage:
    hammer host subscription unregister [OPTIONS]

Options:
 --host HOST_NAME              Name to search by
 --host-id HOST_ID              
 -h, --help                    print help

Comment 10 errata-xmlrpc 2016-09-15 06:21:13 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/RHBA-2016:1886