At first, it was my mistake with script. I do not change 'name' and
'id'.

 

ID and Label Name script

Scriptname: labelid 

#Start Script

#!/usr/bin/perl

use Frontier::Client;

my $HOST = 'spacewalk2.jcorp.ad.jamba.net';

my $user = 'spacewalk';

my $pass = 'spacewalk';

 

my $client = new Frontier::Client(url => "http://$HOST/rpc/api";);

my $session = $client->call('auth.login',$user, $pass);

my $channel = $client->call('channel.listAllChannels', $session);

 

foreach my $channel (@$channel)

{

print ($channel->{'channel_id'});

print ($channel->{'channel_label'}."\n");

}

$client->call('auth.logout', $session);

#End Script

 

[r...@spacewalk2 Desktop]# perl labelid

102fedora-10-i386

103fedora-9-i386

101testen

 

 

Then I use the script from Joaquin

Scriptname: deletepackage

#Start Script

#!/usr/bin/perl

use Frontier::Client;

 

my $HOST = 'spacewalk2.jcorp.ad.jamba.net';

my $user = 'spacewalk';

my $pass = 'spacewalk';

 

my $client = new Frontier::Client(url => "https://$HOST/rpc/api";);

my $session = $client->call('auth.login',$user, $pass);

my $channels =
$client->call('channel.software.listPackagesWithoutChannel', $session);

 

foreach my $channel (@$channels)

{

  print "Deleting orphaned package: ".$channel->{'fedora-10-i386'}."\n";

  $client->call('packages.removePackage', $session, $channel->{'102'} );

}

$client->call('auth.logout', $session);

#End Script

 

 

And now I get failure message

[r...@spacewalk2 Desktop]# perl deletepackage

Deleting orphaned package:

Fault returned from XML RPC Server, fault code -1:
com.redhat.rhn.common.translation.TranslationException: Could not find
translator for class java.lang.String to class java.lang.Integer

 

I don't  know what I must do to delete packages from channel
fedora-10-i386?

Did I something wrong in script?

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Wolf, Christian
Sent: Friday, February 20, 2009 11:19 AM
To: [email protected]
Subject: RE: [Spacewalk-list] removing channels and packages

 

I want to delete all fedora 10 packages. I use this script but nothing
happen. 

Script:

#Start Script

 

 

#!/usr/bin/perl

use Frontier::Client;

 

my $HOST = 'spacewalk2."domain";

my $user = 'spacewalk';

my $pass = 'spacewalk';

 

my $client = new Frontier::Client(url => "https://$HOST/rpc/api";);

my $session = $client->call('auth.login',$user, $pass);

 

my $channels =
$client->call('channel.software.listPackagesWithoutChannel', $session);

 

foreach my $channel (@$channels)

{

 

  print "Deleting orphaned package: ".$channel->{'name'}."\n";

 

  $client->call('packages.removePackage', $session, $channel->{'id'} );

 

}

 

$client->call('auth.logout', $session);

 

 

#End Script

 

Must I delete the packages at first from /var/satellite/redhat/1/ ?

or delete this script also the packages from there and from Spacewalk
UI?

If I delete from Spacewalk UI, this error will display

Service Temporarily Unavailable

The server is temporarily unable to service your request due to
maintenance downtime or capacity problems. Please try again later.

________________________________

Apache/2.2.3 (CentOS) Server at spacewalk2

 

 

Sorry for bad English

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Joaquin Raventos
Sent: Monday, February 16, 2009 4:41 PM
To: [email protected]
Subject: Re: [Spacewalk-list] removing channels and packages

 

Michiel,

Try running this script. Works for me to get rid of all the obsolete
packages. Just change the $HOST, $user, and $pass variables to match you
environment.

Thanks,

Joaquin

------------------------------------------------------------
#Start Script


#!/usr/bin/perl
use Frontier::Client;

my $HOST = 'server.domain.com <http://server.domain.com> ';
my $user = 'user';
my $pass = 'password';

my $client = new Frontier::Client(url => "http://$HOST/rpc/api";);
my $session = $client->call('auth.login',$user, $pass);

my $channels =
$client->call('channel.software.listPackagesWithoutChannel', $session);

foreach my $channel (@$channels)
{

  print "Deleting orphaned package: ".$channel->{'name'}."\n";

  $client->call('packages.removePackage', $session, $channel->{'id'} );

}

$client->call('auth.logout', $session);


#End Script

_______________________________________________
Spacewalk-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-list

Reply via email to