Bug 769276 - subscription-manager has to restart dbus after it change definition in /etc/dbus-1/system.d/com.redhat.SubscriptionManager.conf
Summary: subscription-manager has to restart dbus after it change definition in /etc/d...
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager
Version: 6.2
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: rc
: ---
Assignee: Chris Duryee
QA Contact: IDM QE LIST
URL:
Whiteboard:
Depends On:
Blocks: 738066
TreeView+ depends on / blocked
 
Reported: 2011-12-20 12:45 UTC by Miroslav Suchý
Modified: 2012-03-27 17:12 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-03-27 17:12:05 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Miroslav Suchý 2011-12-20 12:45:39 UTC
Description of problem:
see steps to reproduce

Version-Release number of selected component (if applicable):
subscription-manager-0.96.17-1.el6.x86_64

How reproducible:
deterministic

Steps to Reproduce:
1. install rhel6.1, well at least subscription-manager-0.95.11-1.el6.x86_64 
2. upgrade to rhel6.2, well upgrading to subscription-manager-0.96.17-1.el6 is sufficient
3. execute this python script (taken from bug 744111)
>>> import dbus
>>> bus = dbus.SystemBus()
>>> validity_obj = bus.get_object('com.redhat.SubscriptionManager',
...   '/EntitlementStatus')
>>> validity_iface = dbus.Interface(validity_obj, dbus_interface='com.redhat.SubscriptionManager.EntitlementStatus')
>>> validity_iface.check_status()

Actual results:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/dbus/proxies.py", line 68, in __call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib/python2.6/site-packages/dbus/proxies.py", line 140, in __call__
    **keywords)
  File "/usr/lib/python2.6/site-packages/dbus/connection.py", line 630, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Method "check_status" with signature "" on interface "com.redhat.SubscriptionManager.EntitlementStatus" doesn't exist

Expected results:
dbus.Int32(3)

Additional info:
This is because SM from el6.1 has 
# cat /etc/dbus-1/system.d/com.redhat.SubscriptionManager.conf
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->                                                                  
                                                                                                                             
<!DOCTYPE busconfig PUBLIC                                                                                                   
 "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"                                                                       
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">                                                              
<busconfig>                                                                                                                  
                                                                                                                             
  <policy user="root">                                                                                                       
    <allow own="com.redhat.SubscriptionManager"/>                                                                            
  </policy>                                                                                                                  

  <policy context="default">                                                                                                 
    <allow send_destination="com.redhat.SubscriptionManager"/>                                                               
    <allow send_destination="com.redhat.SubscriptionManager.Compliance"/>
  </policy>

</busconfig>


but in el6.2 it has:
# cat /etc/dbus-1/system.d/com.redhat.SubscriptionManager.conf
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->

<!DOCTYPE busconfig PUBLIC
 "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>

  <policy user="root">
    <allow own="com.redhat.SubscriptionManager"/>
  </policy>

  <policy context="default">
    <allow send_destination="com.redhat.SubscriptionManager"/>
    <allow send_destination="com.redhat.SubscriptionManager.EntitlementStatus"/>
  </policy>

And dbus will not pick up this change automaticaly.
I had to restart messsagebus service to recognize this new method. Not sure if there is easier method (kind of reload), but I guess you should call it from %post scriplet.

I guess that 5.8 will be affected in similar way, but did not tested it.

Comment 2 Miroslav Suchý 2011-12-20 13:40:43 UTC
I just checked rhel5 and it does not seem to be affected by this problem.

Comment 3 Chris Duryee 2012-01-30 19:16:00 UTC
Thanks for the detailed bug report.

This appears to be an issue with dbus not reloading its config without restart. In %post and %preun, we do the following:

dbus-send --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig

This should reload dbus configs. However, I am able to repro this issue and when I run the above command, it does not reload the dbus config. It appears that only a service messagebus restart does the job. I will look more into this to see if there is a better way to restart dbus.

Comment 4 Chris Duryee 2012-01-30 20:29:05 UTC
Miroslav,

It appears that after a few seconds, dbus will reload the config on its own. I wrote two small test scripts, test-61.py which uses the Compliance dbus call, and test-62.py which uses EntitlementStatus. Both scripts print which version of the call they're making, and then attempt to make the call. I updated susbcription-manager, and then the following four commands were run within seconds of each other:

[root@six-one-up ~]# python test-62.py
ENTITLEMENT
<error>
[root@six-one-up ~]# python test-61.py
COMPLIANCE
[root@six-one-up ~]# python test-61.py
COMPLIANCE
<error>
[root@six-one-up ~]# python test-62.py
ENTITLEMENT

Do you see the same behavior?

Comment 5 Miroslav Suchý 2012-01-31 09:53:12 UTC
No.
I just installed rhel6.0, run script from #0 which fail with TB from #0 (this is expected). then upgraded to subscription-manager-0.96.17-1.el6.x86_64. Run script again and I still got TB. I tried to run it in different intervals for 7 minutes and still no luck. I even manualy run
  dbus-send --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig
still the same TB.
Once I executed: 
 service messagebus restart
The script from #0 run without problem.

Comment 6 Chris Duryee 2012-02-17 18:28:09 UTC
Miroslav,

I was installed rhel 6.0 on a vm and did the same upgrade procedure, but I still get the same behavior mentioned in comment #4.

Can you do the same test as you did in comment #5, but instead of performing the dbus-send command manually, do the following instead:

 kill -s SIGHUP `cat /var/run/messagebus.pid`

If that works, I will swap the dbus-send call for the SIGHUP call in the spec file, and we can perform testing to ensure it doesn't create any regressions.

Comment 9 Chris Duryee 2012-03-27 17:12:05 UTC
Miroslav,

I was unable to repro this, and awood was unable as well. We spoke to jsefler, and given the severity of the bug and our inability to reproduce it on clean installs, we agreed that it was ok to close as WORKSFORME.

If this bug becomes more of an issue, let us know and we will look into it some more.


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