[Spacewalk-devel] [PATCH] configure-proxy.sh fails with "ERROR: RHN Proxy does not appear to be registered" if systemIdPath is changed
Hello, On the system it had : systemIdPath=/etc/sysconfig/rhn/systemid.save Most likely due to re-installs of rhn-client-tools or re-registrations the systemid file was saves as systemid.save and it was being used in up2date file. But in such setup configure-proxy.sh fails with the error "ERROR: RHN Proxy does not appear to be registered" Attached is the proposed patch for configure-proxy.sh to refer the systemIdPath in up2date file instead of static systemid file. Thanks ! Paresh >From b744b489fa369b6f4772814d0065a366ce7ac46d Mon Sep 17 00:00:00 2001 From: Paresh Mutha Date: Tue, 24 Sep 2013 15:44:36 +0530 Subject: [PATCH] refer systemIdPath from up2date config Signed-off-by: Paresh Mutha --- proxy/installer/configure-proxy.sh | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh index 3fb2a74..92137c0 100755 --- a/proxy/installer/configure-proxy.sh +++ b/proxy/installer/configure-proxy.sh @@ -253,13 +253,14 @@ HTTPDCONFD_DIR=/etc/httpd/conf.d HTMLPUB_DIR=/var/www/html/pub JABBERD_DIR=/etc/jabberd SQUID_DIR=/etc/squid +SYSTEMID_PATH=`PYTHONPATH='/usr/share/rhn' python -c "from up2date_client import config; cfg = config.initUp2dateConfig(); print cfg['systemIdPath'] "` -if [ ! -r $SYSCONFIG_DIR/systemid ]; then +if [ ! -r SYSTEMID_PATH ]; then echo ERROR: Spacewalk Proxy does not appear to be registered exit 2 fi -SYSTEM_ID=$(/usr/bin/xsltproc /usr/share/rhn/get_system_id.xslt $SYSCONFIG_DIR/systemid | cut -d- -f2) +SYSTEM_ID=$(/usr/bin/xsltproc /usr/share/rhn/get_system_id.xslt $SYSTEMID_PATH | cut -d- -f2) DIR=/usr/share/doc/proxy/conf-template HOSTNAME=$(hostname) @@ -468,8 +469,8 @@ if [ $MONITORING -eq 0 ]; then fi # systemid need to be readable by apache/proxy -chown root:apache $SYSCONFIG_DIR/systemid -chmod 0640 $SYSCONFIG_DIR/systemid +chown root:apache $SYSTEMID_PATH +chmod 0640 $SYSTEMID_PATH #Setup the cobbler stuff, needed to use koan through a proxy PROTO="http"; -- 1.8.3.1 ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
[Spacewalk-devel] [PATCH] Add update_date option in spacewalk-clone-by-date
Hello, Attached is the proposed patch to add update_date option in spacewalk-clone-by-date. (spacewalk bz#947942) Currently spacewalk-clone-by-date refers the issue_date of the errata. But web-ui displays update date. With the attached patch spacewalk-clone-by-date utility can now use update date of errata which will help bring uniformity between the channel cloned to specific date using cli and web-ui. Appreciate your feedback. Once this gets accepted will work on updating the man page of spacewalk-clone-by-date. Regards, Paresh >From 6e525a97f73752773d16696de55a22eeb85f94f7 Mon Sep 17 00:00:00 2001 From: Paresh Mutha Date: Wed, 3 Apr 2013 21:02:34 +0530 Subject: [PATCH] bz#947942 add --use-update-date option Signed-off-by: Paresh Mutha --- utils/cloneByDate.py | 22 ++ utils/spacewalk-clone-by-date | 1 + 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/utils/cloneByDate.py b/utils/cloneByDate.py index 3116685..edde991 100644 --- a/utils/cloneByDate.py +++ b/utils/cloneByDate.py @@ -144,12 +144,12 @@ def main(options): tree_cloner = ChannelTreeCloner(channel_list, xmlrpc, db, options.to_date, options.blacklist, options.removelist, options.background, -options.security_only, options.parents) +options.security_only, options.use_update_date, options.parents) else: tree_cloner = ChannelTreeCloner(channel_list, xmlrpc, db, options.to_date, options.blacklist, options.removelist, options.background, -options.security_only) +options.security_only,options.use_update_date) cloners.append(tree_cloner) needed_channels += tree_cloner.needing_create().values() @@ -202,7 +202,7 @@ class ChannelTreeCloner: # pylint: disable=R0902 def __init__(self, channels, remote_api, db_api, to_date, blacklist, removelist, detached, -security_only, parents = None): +security_only, use_update_date, parents = None): self.remote_api = remote_api self.db_api = db_api self.channel_map = channels @@ -221,13 +221,14 @@ class ChannelTreeCloner: self.channel_details = None self.detached = detached self.security_only = security_only + self.use_update_date = use_update_date self.validate_source_channels() for from_label in self.ordered_labels(): to_label = self.channel_map[from_label] cloner = ChannelCloner(from_label, to_label, self.to_date, self.remote_api, self.db_api, self.detached, - self.security_only) + self.security_only,self.use_update_date) self.cloners.append(cloner) @@ -425,7 +426,7 @@ class ChannelTreeCloner: class ChannelCloner: # pylint: disable=R0902 def __init__(self, from_label, to_label, to_date, remote_api, db_api, -detached, security_only): +detached, security_only,use_update_date): self.remote_api = remote_api self.db_api = db_api self.from_label = from_label @@ -438,6 +439,7 @@ class ChannelCloner: self.old_pkg_hash = {} self.detached = detached self.security_only = security_only + self.use_update_date = use_update_date def dest_label(self): @@ -548,9 +550,13 @@ class ChannelCloner: """ Returns tuple of all available for cloning, and what falls in the date range""" available_errata = self.db_api.applicable_errata(self.from_label, self.to_label) to_clone = [] - + if self.use_update_date: + date_to_use='update_date' + else: + date_to_use='issue_date' + print "Using ",date_to_use for err in available_errata: -if self.to_date and err['issue_date'].date() <= self.to_date.date(): +if self.to_date and err[date_to_use].date() <= self.to_date.date(): if self.security_only: if err['advisory_type'] == 'Security Advisory': to_clone.append(err) @@ -714,7 +720,7 @@ class DBApi: """list of errata that is applicable to be cloned, used db because we need to exclude cloned errata too""" h = rhnSQL.prepare(""" -select e.id, e.advisory_name, e.advisory_type, e.issue_date, e.synopsis +
[Spacewalk-devel] [PATCH] proposed on enable_snapshot in Sever.pm
Hello, We had an issue on snapshot tags reported on satellite (bz#893068). While troubleshooting I see that it is likely a bug due to a typo in Sever.pm. Details below : /etc/rhn/rhn.conf has : # system snapshots enabled enable_snapshots = 1 whereas under /usr/share/perl5/vendor_perl/RHN/DB/Server.pm it checks for enable_snapshot config value which doesn't exist (missing trailing s in config variable): sub snapshot_server { my $class = shift; my %params = validate(@_, {server_id => 1, reason => 1, transaction => 0}); if (!PXT::Config->get('enable_snapshot')) { return; } While creating the snapshot it checks the config value of enable_snapshot which does not exists in default config. Thus inspite of having enable_snapshots=1 in rhn.conf, still it returns without creating a snapshot. Attached the proposed patch to correct the behavior. Appreciate your feedback/thoughts on it. Regards, Paresh >From 178c31f4a232b0d8e036b14e722f195c59667303 Mon Sep 17 00:00:00 2001 From: Paresh Mutha Date: Tue, 8 Jan 2013 19:46:40 +0530 Subject: [PATCH] Fixing enable_snapshot typo BZ#893068 on satellite Signed-off-by: Paresh Mutha --- web/modules/rhn/RHN/DB/Server.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/modules/rhn/RHN/DB/Server.pm b/web/modules/rhn/RHN/DB/Server.pm index 57dc2c0..35c94f6 100644 --- a/web/modules/rhn/RHN/DB/Server.pm +++ b/web/modules/rhn/RHN/DB/Server.pm @@ -1261,7 +1261,7 @@ sub snapshot_server { my $class = shift; my %params = validate(@_, {server_id => 1, reason => 1, transaction => 0}); - if (!PXT::Config->get('enable_snapshot')) { + if (!PXT::Config->get('enable_snapshots')) { return; } @@ -1282,7 +1282,7 @@ sub snapshot_set { my $class = shift; my %params = validate(@_, {set_label => 1, user_id => 1, reason => 1, transaction => 0}); - if (!PXT::Config->get('enable_snapshot')) { + if (!PXT::Config->get('enable_snapshots')) { return; } -- 1.7.11.7 ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
[Spacewalk-devel] [PATCH] Add SAST timezone
Hello, Currently we have (GMT +0200) Europe (Eastern) Timezone which follows DST. But SAST doesn't follow DST. Thus there is a need to add SAST to spacewalk (and satellite). Attached the proposed patch to add SAST timezone. Appreciate your feedback on it. Paresh >From 55efaa2b55b8eea6dec12baaeec9701b9ed3fc0c Mon Sep 17 00:00:00 2001 From: Paresh Mutha Date: Tue, 30 Oct 2012 14:02:01 +0530 Subject: [PATCH] Add SAST timezone Signed-off-by: Paresh Mutha --- .../redhat/rhn/frontend/strings/database/StringResource_en_US.xml | 7 +++ schema/spacewalk/common/data/rhnTimezone.sql | 5 + .../144-rhnTimezone-data.sql | 3 +++ 3 files changed, 15 insertions(+) create mode 100644 schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/144-rhnTimezone-data.sql diff --git a/java/code/src/com/redhat/rhn/frontend/strings/database/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/database/StringResource_en_US.xml index 019fca4..8b0b795 100644 --- a/java/code/src/com/redhat/rhn/frontend/strings/database/StringResource_en_US.xml +++ b/java/code/src/com/redhat/rhn/frontend/strings/database/StringResource_en_US.xml @@ -140,6 +140,13 @@ http://www.oasis-open.org/committees/xliff/documents/xliff-core-1.1.xsd"; + +(GMT+0200) South Africa (Johannesburg) + + /rhn/account/UserDetails + + + (GMT+0200) Europe (Eastern) diff --git a/schema/spacewalk/common/data/rhnTimezone.sql b/schema/spacewalk/common/data/rhnTimezone.sql index a9c1269..8304d6d 100644 --- a/schema/spacewalk/common/data/rhnTimezone.sql +++ b/schema/spacewalk/common/data/rhnTimezone.sql @@ -262,5 +262,10 @@ values (sequence_nextval('rhn_timezone_id_seq'), 'GB-Eire', 'Ireland'); +insert into rhnTimezone + (id, olson_name, display_name) +values + (sequence_nextval('rhn_timezone_id_seq'), + 'Africa/Johannesburg', 'South Africa (Johannesburg)'); commit; diff --git a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/144-rhnTimezone-data.sql b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/144-rhnTimezone-data.sql new file mode 100644 index 000..2f0894e --- /dev/null +++ b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/144-rhnTimezone-data.sql @@ -0,0 +1,3 @@ +INSERT INTO rhnTimezone (id, olson_name, display_name) +VALUES (rhn_timezone_id_seq.nextval, +'Africa/Johannesburg', 'South Africa (Johannesburg)'); -- 1.7.11.7 ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
[Spacewalk-devel] [PATCH] proposed for rhncfg in nightly repo to check stat of local file instead of temp file
Hello, Commit 7a18b250b07ff4ed0c34fa48e69029c114ec3ab1 introduced the check on ownership & permission of the config file so that it doesn't log/display the diff it the config file is not readable by all. Here it is checking the stat for source. But source is always the temp file which is created based on the config file content received from the Server and it is always under root ownership and not readable by all. Thus for all config files which are not owned by root or are readable by all, the diff result is not displayed. Instead there is the message "Differences exist in a file that is not readable by all. Re-deployment of configuration file is recommended" Attached is the proposed patch to check the stat of dst i.e the file present on the system. With this change, for the files which are readable by all the actual diff result would be displayed. Regards, Paresh >From 8a4338b0b6ee7fdf79bee125a4e7f3afb48fbdcd Mon Sep 17 00:00:00 2001 From: Paresh Mutha Date: Wed, 24 Oct 2012 15:28:48 +0530 Subject: [PATCH] fix for bz#869626 use st_mode, st_uid of dst Signed-off-by: Paresh Mutha --- client/tools/rhncfg/config_common/file_utils.py |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/tools/rhncfg/config_common/file_utils.py b/client/tools/rhncfg/config_common/file_utils.py index f386403..13a42a2 100644 --- a/client/tools/rhncfg/config_common/file_utils.py +++ b/client/tools/rhncfg/config_common/file_utils.py @@ -168,8 +168,8 @@ def diff(src, dst, srcname=None, dstname=None): # don't return the diff if the file is not readable by everyone # for security reasons. if (len(ret_list) > 0 # if differences exist -and src_stat.st_uid == 0 # and file is owned by root -and not src_stat.st_mode & stat.S_IROTH): #and not readable by all +and dst_stat.st_uid == 0 # and file is owned by root +and not dst_stat.st_mode & stat.S_IROTH): #and not readable by all ret_list = [ "Differences exist in a file that is not readable by all. ", "Re-deployment of configuration file is recommended."] -- 1.7.1 ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
[Spacewalk-devel] [PATCH] BZ#701344 package profile sync fails if package name has non-ascii char like ® in it
Hello, We had a bugzilla #701344 opened on RHN Satellite where package profile sync would fail if the package name has non-ascii chars in it. I have created a patch on this issue. As it applies to spacewalk as well, I have attached the patch for it. Regards, Paresh >From 48288da277e514411ee6ada4ac8d8ca4cf5979a2 Mon Sep 17 00:00:00 2001 From: Paresh Mutha Date: Thu, 15 Sep 2011 19:23:31 +0530 Subject: [PATCH 3/3] Fix to handle non-ascii chars in package name Signed-off-by: Paresh Mutha --- backend/server/rhnServer/server_packages.py |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/backend/server/rhnServer/server_packages.py b/backend/server/rhnServer/server_packages.py index 29e6b87..6129597 100644 --- a/backend/server/rhnServer/server_packages.py +++ b/backend/server/rhnServer/server_packages.py @@ -24,6 +24,7 @@ from types import DictType from spacewalk.common import log_debug, rhnFault, rhn_rpm from spacewalk.server import rhnSQL from server_lib import snapshot_server, check_entitlement +from types import UnicodeType UNCHANGED = 0 ADDED = 1 @@ -46,6 +47,8 @@ class dbPackage: for k in ('name', 'version', 'release', 'epoch', 'arch'): if pdict[k] == None: return None +if type(pdict['name']) == UnicodeType: +pdict['name'] = unicode.encode(pdict['name'],'utf-8') self.n = str(pdict['name']) self.v = str(pdict['version']) self.r = str(pdict['release']) -- 1.7.6 ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
[Spacewalk-devel] [PATCH] Update CHANNEL_NAME_MAX_LENGTH to 256
Hello, ChannelEditor.pm was updated to allow max channel name length as 256 [1] . But under com/redhat/rhn/manager/channel/CreateChannelCommand.java, it still has 64 as the CHANNEL_NAME_MAX_LENGTH. With this, we can't create channels through spacewalk-create-channel command with length more than 64. We also have a bugzilla for RHN Satellite - https://bugzilla.redhat.com/show_bug.cgi?id=646802 . I have attached the proposed patch for this issue. Regards, Paresh [1] http://git.fedorahosted.org/git/?p=spacewalk.git;a=commit;h=e33a7fb3ca327feb9fd393d47c2e9fbc064b1624 >From fb8f457939fc2ce1155662da14e060d8f722b662 Mon Sep 17 00:00:00 2001 From: Paresh Mutha Date: Thu, 7 Apr 2011 15:41:19 +0530 Subject: [PATCH 2/2] Fix to have consistent channel name max length to 256 Signed-off-by: Paresh Mutha --- .../rhn/manager/channel/CreateChannelCommand.java |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java b/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java index 163e12c..ab0213c 100644 --- a/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java +++ b/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java @@ -36,7 +36,7 @@ import java.util.regex.Pattern; public class CreateChannelCommand { public static final int CHANNEL_NAME_MIN_LENGTH = 6; -public static final int CHANNEL_NAME_MAX_LENGTH = 64; +public static final int CHANNEL_NAME_MAX_LENGTH = 256; public static final int CHANNEL_LABEL_MIN_LENGTH = 6; protected static final String CHANNEL_NAME_REGEX = -- 1.7.4 ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
[Spacewalk-devel] [PATCH] Fix to remove message on entitlement consumption for virt guest subscribed to cloned channels
Hello, Attached a proposed patch which removes the message on entitlement consumption for virtual guest subscribed to cloned channels. (subscribing to cloned channels doesn't consume channel entitlements). Have created a bugzilla for RHN Satellite v5.4 - https://bugzilla.redhat.com/show_bug.cgi?id=692797 Regards, Paresh >From e4ea9c9741c37e3cab92aec78aef78a7680a1283 Mon Sep 17 00:00:00 2001 From: Paresh Mutha Date: Fri, 1 Apr 2011 13:33:28 +0530 Subject: [PATCH] Fix to remove message on entitlement consumption for virt guest subscribed to cloned channels Signed-off-by: Paresh Mutha --- .../webapp/WEB-INF/pages/systems/sdc/channels.jsp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/java/code/webapp/WEB-INF/pages/systems/sdc/channels.jsp b/java/code/webapp/WEB-INF/pages/systems/sdc/channels.jsp index 67c6044..6ed6023 100644 --- a/java/code/webapp/WEB-INF/pages/systems/sdc/channels.jsp +++ b/java/code/webapp/WEB-INF/pages/systems/sdc/channels.jsp @@ -44,7 +44,7 @@ - + * ${channel.name} @@ -61,7 +61,7 @@ - + * -- 1.7.4 ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
[Spacewalk-devel] Proposed patch for setAdvancedOptions API
Hello, Attached proposed patch for setAdvancedOptions API which fails for services and driverdisk. We have https://bugzilla.redhat.com/show_bug.cgi?id=601524 opened for RHN Satellite v5.4 Regards, Paresh >From c3301e2148f2296b6a2af2dfab95501f58a771d2 Mon Sep 17 00:00:00 2001 From: Paresh Mutha Date: Tue, 15 Feb 2011 14:53:06 +0530 Subject: [PATCH 4/4] Fix for typo in setAdvancedOptions API and a missing option Signed-off-by: Paresh Mutha --- .../xmlrpc/kickstart/profile/ProfileHandler.java |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/ProfileHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/ProfileHandler.java index 248fb1a..9ce7c8b 100644 --- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/ProfileHandler.java +++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/ProfileHandler.java @@ -479,7 +479,7 @@ public class ProfileHandler extends BaseHandler { "selinux", "reboot", "firewall", "xconfig", "skipx", "key", "ignoredisk", "autopart", "cmdline", "firstboot", "graphical", "iscsi", "iscsiname", "logging", "monitor", "multipath", "poweroff", "halt", -"service", "shutdown", "user", "vnc", "zfcp"}; +"services", "shutdown", "user", "vnc", "zfcp", "driverdisk"}; List validOptions = Arrays.asList(validOptionNames); -- 1.7.2.3 ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
Re: [Spacewalk-devel] [PATCH] Added NULL checks in setMaxFlex() and setMaxMembers()
Yes but couldn't reach to any conclusion. In reply to your query, I just posted a comment in the satellite bugzilla - https://bugzilla.redhat.com/show_bug.cgi?id=671450#c6 - Paresh On 01/27/2011 01:19 PM, Jan Pazdziora wrote: On Thu, Jan 27, 2011 at 10:07:57AM +0530, Paresh Mutha wrote: Hello, I am proposing a patch which includes NULL checks for setMaxFlex() and setMaxMembers() in ChannelOverview.java. Without that, in few cases where maxFlex or maxMembers were null, it led to NullPointerException and page https://server.example.com/rhn/admin/multiorg/OrgSoftwareSubscriptions.do?oid= failed with an ISE. We already have a bugzilla created for RHN Satellite v5.4 - https://bugzilla.redhat.com/show_bug.cgi?id=671450 Paresh, did you investigate why (in which situation) does the setMaxFlex and/or setMaxMembers get called with null? Shouldn't/couldn't we handle this on the caller's side, rather than in the setter? ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
[Spacewalk-devel] [PATCH] Added NULL checks in setMaxFlex() and setMaxMembers()
Hello, I am proposing a patch which includes NULL checks for setMaxFlex() and setMaxMembers() in ChannelOverview.java. Without that, in few cases where maxFlex or maxMembers were null, it led to NullPointerException and page https://server.example.com/rhn/admin/multiorg/OrgSoftwareSubscriptions.do?oid= failed with an ISE. We already have a bugzilla created for RHN Satellite v5.4 - https://bugzilla.redhat.com/show_bug.cgi?id=671450 Regards, Paresh >From 0bbf4b16fb3b439acc8a761535182a96df63e9e6 Mon Sep 17 00:00:00 2001 From: Paresh Mutha Date: Thu, 27 Jan 2011 10:01:19 +0530 Subject: [PATCH] Added NULL checks in setMaxFlex() and setMaxMembers() Signed-off-by: Paresh Mutha --- .../redhat/rhn/frontend/dto/ChannelOverview.java | 14 -- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/java/code/src/com/redhat/rhn/frontend/dto/ChannelOverview.java b/java/code/src/com/redhat/rhn/frontend/dto/ChannelOverview.java index 0eb5ae0..ba623fb 100644 --- a/java/code/src/com/redhat/rhn/frontend/dto/ChannelOverview.java +++ b/java/code/src/com/redhat/rhn/frontend/dto/ChannelOverview.java @@ -90,7 +90,12 @@ public class ChannelOverview extends BaseDto implements Comparable { * @param maxFlexIn The maxFlex to set. */ public void setMaxFlex(Long maxFlexIn) { -this.maxFlex = maxFlexIn; +if(maxFlexIn == null){ +this.maxFlex = new Long(0L); +} +else{ +this.maxFlex = maxFlexIn; +} } /** @@ -224,7 +229,12 @@ public class ChannelOverview extends BaseDto implements Comparable { * @param maxMembersIn The maxMembers to set. */ public void setMaxMembers(Long maxMembersIn) { -this.maxMembers = maxMembersIn; +if(maxMembersIn == null){ +this.maxMembers = new Long(0L); +} +else{ +this.maxMembers = maxMembersIn; +} } /** -- 1.7.2.3 ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
[Spacewalk-devel] Feature enhancement for rhn-entitlement-report [patch attached]
Hello, Current rhn-entitlement-report utility shipped under spacewalk-backend-tools package provides a report on System and Channel entitlements current usage count in all the organizations. As it didn't include the overall usage summary and flex guest entitlement details, I would like to propose an enhancement on this report which would provide these details as well. I have attached a patch for rhn-entitlement-report which would also provide details on : - Overall/Combined report of System and Channel entitlement usage across RHN Satellite/Spacewalk - Along with the used count it would also display the max limit for usage of that entitlement. - Flex guests entitlement's current usage, max limit and also the no. of currently subscribed systems. So in short this would display the information which was displayed on : https://server.fqdn/rhn/admin/multiorg/SystemEntitlements.do https://server.fqdn/rhn/admin/multiorg/SoftwareEntitlements.do and https://server.fqdn/rhn/systems/SystemEntitlements.do https://server.fqdn/rhn/channels/software/Entitlements.do (for each organization) I have also attached example-rhn-entitlement-report-output.txt which shows how the report would look like. Would like to have thoughts on this. Regards, Paresh --- /usr/bin/rhn-entitlement-report.org 2010-12-25 11:04:44.0 +0530 +++ /usr/bin/rhn-entitlement-report 2010-12-27 13:40:26.0 +0530 @@ -19,6 +19,7 @@ rhnSQL.initDB(db_string) def main(): +printAcrossSatelliteUsage(); list = listOfOrgs() for org in list: printOrgHeader(org); @@ -26,7 +27,26 @@ printChannelEnts(org['id']); printOrgFooter() +def printAcrossSatelliteUsage(): +#This prints summary displayed on https://satellite.fqdn/rhn/admin/multiorg/SystemEntitlements.do and https://satellite.fqdn/rhn/admin/multiorg/SoftwareEntitlements.do which is Channel and Entitlement usage across all organizations + print ("Software Channel Entitlements Across RHN Satellite :") + query = "SELECT cfo.label,SUM(cfo.max_members) as total,SUM(cfo.current_members) as used,(SELECT (cfo2.max_members) - (cfo2.current_members) FROM rhnChannelFamilyOverview cfo2 WHERE cfo2.label = cfo.label AND cfo2.org_id = 1) as available,SUM(cfo.fve_max_members) as total_flex,SUM(cfo.fve_current_members) as used_flex,(SELECT (cfo2.fve_max_members) - (cfo2.fve_current_members) FROM rhnChannelFamilyOverview cfo2 WHERE cfo2.label = cfo.label AND cfo2.org_id = 1) as available_flex FROM rhnChannelFamilyOverview cfo WHERE cfo.max_members is not null and (cfo.current_members !=0 or cfo.fve_current_members!=0) GROUP BY cfo.label, cfo.name HAVING (SUM(cfo.max_members) is not null) ORDER by cfo.name DESC" + list = run_query(query) + print("%35s %s %s %s %s %s %s" % ("Channel Label"," Total ","Regular Used","Available","Total Flex","Flex Used","Available Flex")) + print("%35s %s %s %s %s %s %s" % ("-","--","","-","--","-","--")) + + for item in list: + print("%35s %8s %10s %12s %8s %10s %10s" % (item['label'], str(item['total']),str(item['used']),str(item['available']),str(item['total_flex']),str(item['used_flex']),str(item['available_flex']))) + + print ("\nSystem Entitlements Across RHN Satellite :") + query = "SELECT sgt.label as label,SUM(sg.max_members) as total,SUM(sg.current_members) as used,(SELECT (sg2.max_members) - (sg2.current_members) FROM rhnServerGroup sg2 inner join rhnServerGroupType sgt2 on sg2.group_type = sgt2.id WHERE sg2.org_ID = 1 AND sgt2.label = sgt.label) as available FROM rhnServerGroup sg inner join rhnServerGroupType sgt on sgt.id = sg.group_type WHEREsgt.label != 'sw_mgr_entitled' GROUP BY sgt.label, sgt.id ORDER BY sgt.label" + print("%35s %s %s %s" % ("System Entitelment"," Total "," Used "," Available ")) + print("%35s %s %s %s" % ("--"," - "," "," - ")) + list = run_query(query) + for item in list: + print("%35s %7s %8s %10s" % (item['label'], str(item['total']),str(item['used']),str(item['available']))) + def printOrgHeader(org): print("\n") print("="*40) @@ -39,28 +59,29 @@ def printChannelEnts(id): - query = "select CF.label, PCF.current_members from rhnChannelFamily CF inner join rhnPrivateChannelFamily PCF on CF.id = PCF.channel_family_id where PCF.org_id = %d order by CF.label" % (id) +# query = "select CF.label, PCF.current_members,PCF.max_members from rhnChannelFamily CF inner join rhnPrivateChannelFamily PCF on CF.id = PCF.channel_family_id where PCF.org_id = %d order by CF.label" % (id) + query = "SELECT CFO.label, CFO.current_members, CFO.max_members,CFO.fve_current_members as current_flex, CFO.fve_max_members as max_flex,(select count(*) from rhnServerChannel sc inner join rhnChannelFamilyMembers CFM on CFM.channel_id = sc.channel_id where CFM.channel_family_id = CFO.id) as subscribe_count