perl script error message using 'channel.software.clone' API call to RHN Satellite 5.3

Solution Unverified - Updated -

Environment

  • Red Hat Network (RHN) Satellite 5.3.0
  • perl 5.8

Issue

  • Customer connecting Red Hat Network (RHN) Satellte 5.3 API
  • Using in the perl script below code :
<code>my $cloned_id = $client-&gt;call('channel.software.clone', $session, $flabel, $name, $label, $tsummary, $parent_label, $arch_label, $gpg_url, $gpg_id, $gpg_fingerprint, $description, $original_state);</code>
  • Results is the following output
<code>Fault returned from XML RPC Server, fault code -1: redstone.xmlrpc.XmlRpcFault: Could not find method clone in class class com.redhat.rhn.frontend.xmlrpc.channel.software.ChannelSoftwareHandler</code>
  • What is the reason for this error?

Resolution

  • The construction of the original script had too many values defined in the lower channel.software.clone string. These need to be set in the global section with only a reference in the channel.software.clone line.

  • Modified script that works properly with the `channel.software.clone API:


#!/usr/bin/perl -w use strict; use Frontier::Client; use Data::Dumper; my $HOST = 'satellite.example.com'; my $client = new Frontier::Client(url => "http://$HOST/rpc/api"); my $session = $client->call('auth.login', '***login***', '***password***'); my $channels = $client->call('channel.listAllChannels', $session); for my $channel (@$channels) { if ($channel->{'provider_name'} eq 'Red Hat, Inc.') { print "$channel->{'label'}\n"; if ($channel->{'name'} =~ /Red Hat Enterprise Linux/) { my $flabel = $channel->{'label'}; my $original_state = $client->boolean(1); my $channel_info; $channel_info->{'name'} = "rhn dev " . $channel->{'name'}; $channel_info->{'label'} = "rhn-dev-" . $channel->{'label'}; $channel_info->{'summary'} = "rhn dev " . $channel->{'name'}; $channel_info->{'parent_label'} = $flabel; $channel_info->{'description'} = "rhn dev " . $channel->{'name'}; my $cloned_id = $client->call('channel.software.clone', $session, $flabel, $channel_info, $original_state); print "available subscriptions for $flabel is $cloned_id\n"; } } }

Diagnostic Steps

  • Original test script which failed for channel.software.clone information.

#!/usr/bin/perl -w use strict; use Frontier::Client; use Data::Dumper; my $HOST = 'satellite.example.com'; my $client = new Frontier::Client(url => "http://$HOST/rpc/api"); my $session = $client->call('auth.login', '**login**', '**password***'); my $channels = $client->call('channel.listAllChannels', $session); for my $channel (@$channels) { if ($channel->{'provider_name'} eq 'Red Hat, Inc.') { print "$channel->{'label'}\n"; if ($channel->{'name'} =~ /Red Hat Enterprise Linux/) { my $fname = $channel->{'name'}; my $flabel = $channel->{'label'}; my $fsummary = $channel->{'name'}; my $fdescription = $channel->{'name'}; my $tname = "rhn dev " . $channel->{'name'}; my $tlabel = "rhn-dev-" . $channel->{'label'}; my $tsummary = "rhn dev " . $channel->{'name'}; my $tdescription = "rhn dev " . $channel->{'name'}; my ($name, , $label, $summary, $parent_label, $arch_label, $gpg_url, $gpg_id, $gpg_fingerprint, $description, $original_state) = ($tname, $tlabel, $tsummary, $flabel, "", "", "", "", "$tdescription", "1"); my $cloned_id = $client->call('channel.software.Clone', $session, $flabel, $name, $label, $tsummary, $parent_label, $arch_label, $gpg_url, $gpg_id, $gpg_fingerprint, $description, $original_state); print "available subscriptions for $flabel is $cloned_id\n"; } } }

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.