Bug 817484
Summary: | delete-old-systems-interactive does not work | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Red Hat Satellite 5 | Reporter: | Dimitar Yordanov <dyordano> | ||||||
Component: | Other | Assignee: | Michael Mráka <mmraka> | ||||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | Dimitar Yordanov <dyordano> | ||||||
Severity: | medium | Docs Contact: | |||||||
Priority: | medium | ||||||||
Version: | 541 | CC: | cperry, jpazdziora, mmraka | ||||||
Target Milestone: | --- | ||||||||
Target Release: | --- | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | spacewalk-utils-1.7.15-35 | Doc Type: | Bug Fix | ||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2012-09-21 09:33:38 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: | 819081 | ||||||||
Attachments: |
|
Comment 1
Tomas Lestach
2012-05-02 09:00:02 UTC
I am not sure that it I provide reproducer it will work for you. I tried to use the tool and I noticed that profiles that should be removed from the script are not removed. I looked into the code and what I discovered was that there is a comparison between GMT local time and EDT time returned from the "system.list_user_systems" API call. I did the following changes in order the script to work correctly if Satellite runs on localhost. #my ($sec, $min, $h, $d, $m, $y) = gmtime($not_before); my ($sec, $min, $h, $d, $m, $y) = localtime($not_before); my $cutoff = sprintf '%04d%02d%02dT%02d:%02d:%02d', $y + 1900,$m + 1, $d, $h, $min, $sec; #print "Lookup on [$host] systems with last checkin before [$cutoff] GMT\n"; print "Lookup on [$host] systems with last checkin before [$cutoff] \n"; my $client = new Frontier::Client(url => "http://$host/rpc/api", debug=>0); my $session = $client->call('auth.login', $username, $passwd) or die "Failed to login to [$host]\n"; my $systems = $client->call('system.list_user_systems', $session); $systems = [ sort { $a->{last_checkin} cmp $b->{last_checkin} } map { if (ref $_->{last_checkin}) { $_->{last_checkin} = $_->{last_checkin}->value } else { $_->{last_checkin} =~ s/-//g; }; $_;} @$systems ]; For all the changes that I made please see attachment. Created attachment 581590 [details]
Script with all the fixes.
Miroslav, would you, please check, whether Dimitar's changes of utils/delete-old-systems-interactive are acceptable? Fixed in spacewalk master by commit babadbfbc3036036a389788f311eaf38d8baf9ee system.list_user_systems() now returns localtime Backported to SATELLITE-5.5 as commit 9e9d4315b3e243d84c75552b3d446165479d852d system.list_user_systems() now returns localtime Created attachment 593574 [details]
Fixed Script Final.
Fixed in spacewalk master as commit 8018f8d70ccb0070678f0c968ca3b4b5d5663e7e 817484 - strip non-number chars from date format because we compare dates as numbers Backported to SATELLITE-5.5 as commit fabff987e299bb98c1816c15df171ff42f67e0ab 817484 - strip non-number chars from date format (In reply to comment #10) > Fixed in spacewalk master as > commit 8018f8d70ccb0070678f0c968ca3b4b5d5663e7e > 817484 - strip non-number chars from date format > because we compare dates as numbers This is not true. We do "lt" which is string operation. The whole "let's remove non-numbers and compare as numeric values" is wrong. Please revert the commit 8018f8d70ccb0070678f0c968ca3b4b5d5663e7e. Fixed typo in spacewalk master commit d0b5a97f0258ae020f5b0500ed406a1b4e8d9d62 817484 - fixed typo Backported to SATELLITE-5.5 commit dabdb6fe940aa95c1e19c329908174e4d3b1c57b 817484 - fixed typo This issue is resolved with the release of RHN Satellite 5.5. As of September 20th 2012, RHN Satellite 5.5 has been generally available. Release Notes and other 5.5 documentation can be found here: https://access.redhat.com/knowledge/docs/Red_Hat_Network_Satellite/ The associated Errata for the 5.5 release are: 5.5 Satellite GA Errata - http://rhn.redhat.com/errata/RHEA-2012-1296.html 5.5 Upgrade Errata - http://rhn.redhat.com/errata/RHEA-2012-1298.html 5.5 RHN Proxy GA Errata - http://rhn.redhat.com/errata/RHEA-2012-1297.html 5.5 RHN Tools GA Errata - http://rhn.redhat.com/errata/RHEA-2012-1299.html Regards, Clifford - Engineering Manager, Satellite |