[Spacewalk-list] Python API: create software Channel with gpgkey information

Michael Mraka michael.mraka at redhat.com
Tue Dec 7 10:33:38 UTC 2010


Waldemar Gorus wrote:
% Hello,
% 
% I am just testing spacewalk a lot. For that I wrote a python script
% for creating, cloning, synchronizing and deleting channels
% automatically. I would like to set the gpgkey-information during the
% progress of channel creation, but I have problems with the method
% declaration:

Hi Waldemar,

spacewalk-common-channel script from spacewalk-utils package does the
similar job (creates channels for the most common distributions incl.
gpg ingormations and activation keys) so you can either reuse it or
use it as source for you own script.

% The following python piece works well without the additional gpgKey
% information, but fails with. Somehow I fail with the python struct
% 'construct'. Thank you for any hints
% 
% for section in channelList:
%        client.channel.software.create (sKey,                section,
%                config.get(section, "name"),
%                config.get(section, "summary"),
%                config.get(section, "archLabel"),
%                config.get(section, "parentLabel"),
%                config.get(section, "checksumType"),
%                pack('sss', config.get(section, "gpgKey.url"),
%                        config.get(section, "gpgKey.id"),
%                        config.get(section, "gpgKey.print")))

It's probably not very clear, the struct is dict so it sould be:

                  { 'url': config.get(section, "gpgKey.url"),
                    'id' : config.get(section, "gpgKey.id"),
                    'fingerprint': config.get(section, "gpgKey.print")})


% Here is the method from spacewalk doc API used:
% 
%      Method: create
%      <https://i5spacewalk/rhn/apidoc/handlers/ChannelSoftwareHandler.jsp#top>
% 
% Description:
% Creates a software channel
% 
% Parameters:
% 
%    * string sessionKey
%    * string label - label of the new channel
%    * string name - name of the new channel
%    * string summary - summary of the channel
%    * string archLabel - the label of the architecture the channel
%      corresponds to
%          o channel-ia32 - For 32 bit channel architecture
%          o [..]
%    * string parentLabel - label of the parent of this channel, an empty
%      string if it does not have one
%    * string checksumType - checksum type for this channel, used for yum
%      repository metadata generation
%          o sha1 - Offers widest compatibility with clients
%          o sha256 - Offers highest security, but is compatible only
%            with newer clients: Fedora 11 and newer, or Enterprise Linux
%            6 and newer.
%    * struct - gpgKey
%          o string "url" - GPG key URL
%          o string "id" - GPG key ID
%          o string "fingerprint" - GPG key Fingerprint
% 
% Thank you
% Waldemar

Regards,

--
Michael Mráka
Satellite Engineering, Red Hat




More information about the Spacewalk-list mailing list