commit 8ccfc5ec3006f4fee71e549217a4d335163aded6 Author: Radek Novacek rnovacek@redhat.com Date: Thu Oct 6 10:38:46 2011 +0200
Use updateConsumer API instead of updateConsumerFacts
The new API overcomes the limit of 255 chars length of the fact. Related: rhbz#743823
subscriptionmanager.py | 17 +++-------------- virt-who.spec | 7 +++++-- 2 files changed, 8 insertions(+), 16 deletions(-) --- diff --git a/subscriptionmanager.py b/subscriptionmanager.py index 34c756c..b65ae77 100644 --- a/subscriptionmanager.py +++ b/subscriptionmanager.py @@ -62,28 +62,17 @@ class SubscriptionManager:
def sendVirtGuests(self, domains): """ Update consumer facts with UUIDs of virtual guests. """ - # Get consumer facts from server - facts = self.getFacts()
# Get comma separated list of UUIDs uuids = [] for domain in domains: uuids.append(domain.UUIDString()) uuids.sort() - uuids_string = ",".join(uuids)
- # Check if facts differ - if "virt.guests" in facts and facts["virt.guests"] == uuids_string: - # There are the same, no need to update them - self.logger.debug("No need to update facts (%s)" % facts["virt.guests"]) - return + self.logger.debug("Sending update to updateConsumer: %s" % uuids)
- # Update consumer facts - self.logger.debug("Sending updates virt.guests facts: %s" % uuids_string) - facts["virt.guests"] = uuids_string - - # Send it to the server - self.connection.updateConsumerFacts(self.uuid(), facts) + # Send list of guest uuids to the server + self.connection.updateConsumer(self.uuid(), guest_uuids=uuids)
def uuid(self): """ Read consumer certificate and get consumer UUID from it. """ diff --git a/virt-who.spec b/virt-who.spec index 65c16b8..f1e3b22 100644 --- a/virt-who.spec +++ b/virt-who.spec @@ -1,6 +1,6 @@ Name: virt-who Version: 0.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Agent for reporting virtual guest IDs to subscription-manager
Group: System Environment/Base @@ -13,7 +13,7 @@ BuildArch: noarch BuildRequires: python2-devel Requires: libvirt-python Requires: libvirt -Requires: python-rhsm +Requires: python-rhsm >= 0.96.13 Requires(post): chkconfig Requires(preun): chkconfig # This is for /sbin/service @@ -66,6 +66,9 @@ fi
%changelog +* Thu Oct 06 2011 Radek Novacek rnovacek@redhat.com - 0.3-2 +- Requires python-rhsm >= 0.96.13 (contains fix for char limit in uuid list) + * Thu Sep 01 2011 Radek Novacek rnovacek@redhat.com - 0.3-1 - Add initscript and configuration file
virt-who-devel@lists.fedorahosted.org