Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 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 "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". 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 "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-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 1304074

Summary: [RFE] Provide a D-Bus API for Registering a system
Product: Red Hat Enterprise Linux 7 Reporter: Barnaby Court <bcourt>
Component: subscription-managerAssignee: Alex Wood <awood>
Status: CLOSED ERRATA QA Contact: Sean Toner <stoner>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: csnyder, khowell, stoner
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 19:18:42 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:
Bug Depends On:    
Bug Blocks: 1313485, 1395274    
Attachments:
Description Flags
using busctl to call Register method
none
using busctl to call RegisterWithActivationKeys method none

Description Barnaby Court 2016-02-02 19:45:20 UTC

Comment 3 Sean Toner 2017-04-17 18:57:46 UTC
I manually tested by doing the following:

Created a stage account, and edit the /etc/rhsm/rhsm.conf to point to the stage candlepin.  I also generated an activation key from the stage customer portal.  I 

I then ran `systemctl restart rhsm.service` and then ran `subscription-manager orgs` to get the org ID.  I made sure that the dbus service was running by calling:

busctl | grep RHSM

and verified that the service was running and not activatable.  I then did the first part of registering by starting the register server:

busctl call com.redhat.RHSM1 /com/redhat/RHSM1/RegisterServer com.redhat.RHSM1.RegisterServer Start

This gave me the reply back of:

s "unix:abstract=/var/run/dbus-hFLSsUWi7q,guid=1cc8ab09c9c716d9f755819358f50415"


This response provided the unix socket ID of "unix:abstract=/var/run/dbus-hFLSsUWi7q", which is necessary for the other busctl calls.  Since the register server now had a unix socket to communicate over (a peer-to-peer), the call to actually do the registering was done as below:

busctl call --address=unix:abstract=/var/run/dbus-hFLSsUWi7q com.redhat.RHSM1 /com/redhat/RHSM1/Register com.redhat.RHSM1.Register Register 'sssa{sv}' 10930238 BZ1304074 ________ 0

The 10930238, BZ1304074 and _______ are the org, username and password respectively.  The result of running the above command can be seen in the attachment Register.txt.  Lastly, I also tested registering via an activation key.  The command to do this was:

busctl call --address=unix:abstract=/var/run/dbus-hFLSsUWi7q com.redhat.RHSM1 /com/redhat/RHSM1/Register com.redhat.RHSM1.Register RegisterWithActivationKeys 'sasa{sv}' 10930238 1 BZ1304074-Key 0

Where "10930238 1 BZ1304074-Key 0" is the encoding for dbus args using busctl where I passed in just one activation key with a name of BZ1304074-Key, and no extra args were used for registration.  The result of this command can be seen in the attachment RegisterWithKey.txt

Comment 4 Sean Toner 2017-04-17 18:58:45 UTC
Created attachment 1272141 [details]
using busctl to call Register method

Comment 5 Sean Toner 2017-04-17 18:59:59 UTC
Created attachment 1272142 [details]
using busctl to call RegisterWithActivationKeys method

Comment 6 Sean Toner 2017-04-17 19:03:49 UTC
Tested against:

[root@stoner-rhel-74 subman1.9.7]# rpm -qa | grep  subscription
subscription-manager-1.19.7-1.el7.x86_64
subscription-manager-plugin-container-1.19.7-1.el7.x86_64
subscription-manager-migration-data-2.0.35-1.el7.noarch
subscription-manager-plugin-ostree-1.19.7-1.el7.x86_64
subscription-manager-migration-1.19.7-1.el7.x86_64
subscription-manager-initial-setup-addon-1.19.7-1.el7.x86_64
subscription-manager-gui-1.19.7-1.el7.x86_64

Comment 7 errata-xmlrpc 2017-08-01 19:18:42 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-2017:2083