Trent,
Thanks for the patch.  I created a new module for repos, so the repo functions
are now repo_list and repo_details; softwarechannel was getting a bit cluttered.
They should be there in versions >= 1.4.5.

I don't use repos in Spacewalk, but I'd be more than happy to commit any patches
that implement this functionality.  

Aron Parsons, RHCA
Senior Consultant
Red Hat Consulting

----- Original Message -----
Date: Mon, 28 Mar 2011 08:30:52 -0500
From: Trent Johnson <tljoh...@oreillyschool.com>
To: spacewalk-devel@redhat.com
Subject: [Spacewalk-devel] [Patch] List repos from spacecmd
Message-ID: <4d908d8c.8060...@oreillyschool.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

I needed to list repos from spacecmd.  See attached.

Also, it would be nice if repos could be associated etc. from spacecmd.

Thanks,
Trent


--- old//usr/lib/python2.6/site-packages/spacecmd/softwarechannel.py 
2011-03-28 07:45:40.062935272 -0500
+++ /usr/lib/python2.6/site-packages/spacecmd/softwarechannel.py 
2011-03-28 07:40:13.962940058 -0500
@@ -67,6 +67,21 @@
              print '\n'.join(sorted(channels))

  ####################
+def help_softwarechannel_listrepos(self):
+    print 'softwarechannel_listrepos: List all available user repos'
+    print 'usage: softwarechannel_listrepos'
+
+def do_softwarechannel_listrepos(self, args, doreturn=False):
+    repos = self.client.channel.software.listUserRepos(self.session)
+    repos = [c.get('label') for c in repos]
+
+    if doreturn:
+        return repos
+    else:
+        if len(repos):
+            print '\n'.join(sorted(repos))
+
+####################

  def help_softwarechannel_listbasechannels(self):
      print 'softwarechannel_listbasechannels: List all base software 
channels'
@@ -260,6 +275,38 @@

  ####################

+def help_softwarechannel_repodetails(self):
+    print 'softwarechannel_repodetails: Show the details of a user repo'
+    print 'usage: softwarechannel_repodetails <repo ...>'
+
+def complete_softwarechannel_repodetails(self, text, line, beg, end):
+    return tab_completer(self.do_softwarechannel_listrepos('', True), text)
+
+def do_softwarechannel_repodetails(self, args):
+    (args, options) = parse_arguments(args)
+
+    if not len(args):
+        self.help_softwarechannel_repodetails()
+        return
+
+    # allow globbing of software channel names
+    repos = filter_results(self.do_softwarechannel_listrepos('', True), 
args)
+
+    add_separator = False
+
+    for repo in repos:
+        details = self.client.channel.software.getRepoDetails(\
+                                    self.session, repo)
+
+        if add_separator: print self.SEPARATOR
+        add_separator = True
+
+        print 'Repository Label:   %s' % details.get('label')
+        print 'Repository Url:     %s' % details.get('sourceUrl')
+        print 'Repository Type:    %s' % details.get('type')
+
+####################
+
  def help_softwarechannel_listerrata(self):
      print 'softwarechannel_listerrata: List the errata associated with a'
      print '                            software channel'



------------------------------

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

End of Spacewalk-devel Digest, Vol 34, Issue 28
***********************************************

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to