Bug 466195 - RHN API inconsistency and misnomers: listBaseChannels, listChildChannels, listSubscribedChildChannels
Summary: RHN API inconsistency and misnomers: listBaseChannels, listChildChannels, lis...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: API
Version: 511
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Brad Buckingham
QA Contact: wes hayutin
URL:
Whiteboard:
Depends On:
Blocks: 456996
TreeView+ depends on / blocked
 
Reported: 2008-10-09 01:08 UTC by Xixi
Modified: 2009-09-10 19:53 UTC (History)
3 users (show)

Fixed In Version: sat530
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-10 19:53:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Xixi 2008-10-09 01:08:50 UTC
Description of problem:

The names of the following methods are misleading:

1. 
system.listBaseChannels
system.listChildChannels

These two actually lists *subscribable* channels not *subscribed* channels which is contrary to the impression of their names.

They should be changed to 

system.listSubscribableBaseChannels
system.listSubscribableBaseChannels

2. There is the method system.listSubscribedChildChannels but no system.listSubscribedBaseChannels - this seems an oversight.

Workaround is to use channel.software.listSystemChannels

Version-Release number of selected component (if applicable):
Sat 5.1.1 and possibly earlier

How reproducible:
Always

Steps to Reproduce:
1. See above or just go to API docs on Satellite.
2.
3.
  
Actual results:
See above.

Expected results:
Ditto.

Additional info:

Comment 1 Xixi 2008-10-09 01:12:44 UTC
(In reply to comment #0)
Sorry for the typo, 

> They should be changed to 
> 
> system.listSubscribableBaseChannels
> system.listSubscribableBaseChannels

should be

> They should be changed to 
> 
> system.listSubscribableBaseChannels
> system.listSubscribableChildChannels

Comment 2 Brandon Perkins 2008-10-09 23:08:16 UTC
Ideally we should probably split this bug up.  And also we have to deal with deprecation of we are changing functionality.  We may just need to change the docs and leave the bad names (and deprecate them).

Comment 3 Brad Buckingham 2009-03-03 20:50:45 UTC
git commit: 8ca9e3b4c48c328d226c56ec748bd0a52649c9fa

deprecated: (APIs still exist, but docs define as deprecated)
- system.listBaseChannels
- system.listChildChannels

new: (code basically moved from the deprecated methods above)
- system.listSubscribableBaseChannels
- system.listSubscribableChildChannels

note:
- channel.software.listSystemChannels - left alone for now
- for getting the current subscribed channels the following APIs currently exist;
  therefore, no changes made at this time:
  - system.getSubscribedBaseChannel
  - system.listSubscribedChildChannels

Comment 4 wes hayutin 2009-03-23 20:25:17 UTC
logged in (admin/dog8code), token: '1160xeef166b32f0da4e208c553af11d81ce6'
Processing method: activationkey.create
activation key: key=1-69a7cb93e8f0c3e92018404a1be44079, created
Processing method: registration.new_system
System Registered 1000010179  - api-test6nhP7FSNKJVC3
Reading package profile: /rhel-i386-as-5.json
[{summary=Red Hat Enterprise Linux Virtualization Environment (v. 5 for 32-bit x86 Server), arch_name=IA-32, id=122, end_of_life=, gpg_key_fp=, description=Red Hat Enterprise Linux - Server virtualization environment (v. 5 for 32-bit x86), name=RHEL Virtualization (v. 5 for 32-bit x86), parent_channel_label=rhel-i386-server-5, label=rhel-i386-server-vt-5, gpg_key_url=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release, gpg_key_id=}]
Removing system with sid - 1000010179




List<Map> list = (List<Map>) client.execute("system.list_subscribable_base_channels", securityToken, getSampleSystemId());
	    assertTrue(list.size() > 0);
	    for (Map map : list) {
	    	assertTrue(map.get("id") instanceof Integer);
	    	assertTrue(map.get("name") instanceof String);
	    	assertTrue(map.get("label") instanceof String);
	    	assertTrue( (Integer) map.get("current_base") == 0 || (Integer) map.get("current_base") == 1);
	    }	

passes

Comment 5 Miroslav Suchý 2009-08-13 12:06:16 UTC
verified in stage.

from web page:
Deprecated as of version - being replaced by listSubscribableBaseChannels(string sessionKey, int serverId) 
Deprecated as of version - being replaced by listSubscribableChildChannels(string sessionKey, int serverId) 

using script:
[root@xen5 ~]# cat api.pl
#!/usr/bin/perl
use Frontier::Client;
use Data::Dumper;

my $HOST = 'test1182.test.redhat.com';
my $user = 'msuchy';
my $pass = 'XXX';

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

my $systems = $client->call('system.listSubscribableBaseChannels', $session, 1000013340);
print Dumper($systems),"\n";
my $systems = $client->call('system.listSubscribableChildChannels', $session, 1000013340);
print Dumper($systems),"\n";

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

I got:
[root@xen5 ~]# perl api.pl
$VAR1 = [
          {
            'current_base' => '1',
            'name' => 'Red Hat Enterprise Linux (v. 5 for 32-bit x86)',
            'id' => '165',
.... snip ....
        ];

$VAR1 = [
          {
            'has_license' => '',
            'gpg_key_url' => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release',
            'summary' => 'Red Hat Enterprise Linux Clustering Option (v. 5 for 32-bit x86 Server)',
            'name' => 'RHEL Clustering (v. 5 for 32-bit x86)',
.... snip ....

Comment 6 Brandon Perkins 2009-09-10 19:53:37 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-1434.html


Note You need to log in before you can comment on or make changes to this bug.