rel-eng/packages/spacecmd | 2
spacecmd/spacecmd.spec | 9 +++
spacecmd/src/lib/repo.py | 4 +
spacecmd/src/lib/softwarechannel.py | 88 ++++++++++++++++++++++++++++++++++++
4 files changed, 100 insertions(+), 3 deletions(-)
New commits:
commit f6923dc5586b91e1157289a054769172b7130da3
Author: Aron Parsons <aronparsons(a)gmail.com>
Date: Thu Dec 5 19:41:44 2013 -0500
Automatic commit of package [spacecmd] release [2.1.18-1].
diff --git a/rel-eng/packages/spacecmd b/rel-eng/packages/spacecmd
index 537accd..85e5616 100644
--- a/rel-eng/packages/spacecmd
+++ b/rel-eng/packages/spacecmd
@@ -1 +1 @@
-2.1.17-1 spacecmd/
+2.1.18-1 spacecmd/
diff --git a/spacecmd/spacecmd.spec b/spacecmd/spacecmd.spec
index 4ab38d8..2cf3bf4 100644
--- a/spacecmd/spacecmd.spec
+++ b/spacecmd/spacecmd.spec
@@ -4,7 +4,7 @@
%endif
Name: spacecmd
-Version: 2.1.17
+Version: 2.1.18
Release: 1%{?dist}
Summary: Command-line interface to Spacewalk and Satellite servers
@@ -64,6 +64,13 @@ touch %{buildroot}/%{python_sitelib}/spacecmd/__init__.py
%doc %{_mandir}/man1/spacecmd.1.gz
%changelog
+* Thu Dec 05 2013 Aron Parsons <aronparsons(a)gmail.com> 2.1.18-1
+- spacecmd: print repos in softwarechannel_getdetails
+- spacecmd: add softwarechannel_listrepos
+- spacecmd: add softwarechannel_removerepo
+- spacecmd: add softwarechannel_addrepo
+- spacecmd: fix tab completion for repo_addfilters
+
* Thu Dec 05 2013 Milan Zazrivec <mzazrivec(a)redhat.com> 2.1.17-1
- package search: make sure the lucene search syntax works
commit 79ec600cec0498d10f1650aa608fc1c0bdac4269
Author: Aron Parsons <aronparsons(a)gmail.com>
Date: Thu Dec 5 19:41:24 2013 -0500
spacecmd: print repos in softwarechannel_getdetails
diff --git a/spacecmd/src/lib/softwarechannel.py b/spacecmd/src/lib/softwarechannel.py
index 3f03c26..d755db8 100644
--- a/spacecmd/src/lib/softwarechannel.py
+++ b/spacecmd/src/lib/softwarechannel.py
@@ -370,6 +370,13 @@ def do_softwarechannel_details(self, args):
for tree in trees:
print tree.get('label')
+ if details.get('contentSources'):
+ print
+ print 'Repos'
+ print '-----'
+ for repo in details.get('contentSources'):
+ print repo.get('label')
+
####################
def help_softwarechannel_listerrata(self):
commit b4c7af7242743962a8bd0f348a6d4591888d39e2
Author: Aron Parsons <aronparsons(a)gmail.com>
Date: Thu Dec 5 19:38:43 2013 -0500
spacecmd: add softwarechannel_listrepos
diff --git a/spacecmd/src/lib/softwarechannel.py b/spacecmd/src/lib/softwarechannel.py
index c4039c9..3f03c26 100644
--- a/spacecmd/src/lib/softwarechannel.py
+++ b/spacecmd/src/lib/softwarechannel.py
@@ -1651,7 +1651,7 @@ def do_softwarechannel_addrepo(self, args):
####################
def help_softwarechannel_removerepo(self):
- print 'softwarechannel_removerepo: Add a repo to a software channel'
+ print 'softwarechannel_removerepo: Remove a repo from a software channel'
print 'usage: softwarechannel_removerepo CHANNEL REPO'
def complete_softwarechannel_removerepo(self, text, line, beg, end):
@@ -1682,4 +1682,24 @@ def do_softwarechannel_removerepo(self, args):
self.client.channel.software.disassociateRepo(self.session, channel, repo)
+####################
+
+def help_softwarechannel_listrepos(self):
+ print 'softwarechannel_listrepos: List the repos for a software channel'
+ print 'usage: softwarechannel_listrepos CHANNEL'
+
+def complete_softwarechannel_listrepos(self, text, line, beg, end):
+ parts = line.split(' ')
+
+ return tab_completer(self.do_softwarechannel_list('', True), text)
+
+def do_softwarechannel_listrepos(self, args):
+ (args, options) = parse_arguments(args)
+
+ details = self.client.channel.software.getDetails(self.session, args[0])
+ repos = [r.get('label') for r in details.get('contentSources')]
+
+ if len(repos):
+ print '\n'.join(sorted(repos))
+
# vim:ts=4:expandtab:
commit a14794b6be6ffdc6513e6303f9291d371551ac59
Author: Aron Parsons <aronparsons(a)gmail.com>
Date: Thu Dec 5 19:35:29 2013 -0500
spacecmd: add softwarechannel_removerepo
diff --git a/spacecmd/src/lib/softwarechannel.py b/spacecmd/src/lib/softwarechannel.py
index 6966b79..c4039c9 100644
--- a/spacecmd/src/lib/softwarechannel.py
+++ b/spacecmd/src/lib/softwarechannel.py
@@ -1648,4 +1648,38 @@ def do_softwarechannel_addrepo(self, args):
self.client.channel.software.associateRepo(self.session, channel, repo)
+####################
+
+def help_softwarechannel_removerepo(self):
+ print 'softwarechannel_removerepo: Add a repo to a software channel'
+ print 'usage: softwarechannel_removerepo CHANNEL REPO'
+
+def complete_softwarechannel_removerepo(self, text, line, beg, end):
+ parts = line.split(' ')
+
+ if len(parts) == 2:
+ return tab_completer(self.do_softwarechannel_list('', True),
+ text)
+ elif len(parts) == 3:
+ try:
+ details = self.client.channel.software.getDetails(self.session,
+ parts[1])
+ repos = [r.get('label') for r in details.get('contentSources')]
+ except:
+ return
+
+ return tab_completer(repos, text)
+
+def do_softwarechannel_removerepo(self, args):
+ (args, options) = parse_arguments(args)
+
+ if len(args) < 2:
+ self.help_softwarechannel_removerepo()
+ return
+
+ channel = args[0]
+ repo = args[1]
+
+ self.client.channel.software.disassociateRepo(self.session, channel, repo)
+
# vim:ts=4:expandtab:
commit 25f4f7c2b4612b6cb9a45d9b09fd78ae22a546be
Author: Aron Parsons <aronparsons(a)gmail.com>
Date: Thu Dec 5 19:24:28 2013 -0500
spacecmd: add softwarechannel_addrepo
diff --git a/spacecmd/src/lib/softwarechannel.py b/spacecmd/src/lib/softwarechannel.py
index e4b537d..6966b79 100644
--- a/spacecmd/src/lib/softwarechannel.py
+++ b/spacecmd/src/lib/softwarechannel.py
@@ -1621,4 +1621,31 @@ def do_softwarechannel_setsyncschedule(self, args):
self.client.channel.software.syncRepo(self.session, channel, schedule)
+####################
+
+def help_softwarechannel_addrepo(self):
+ print 'softwarechannel_addrepo: Add a repo to a software channel'
+ print 'usage: softwarechannel_addrepo CHANNEL REPO'
+
+def complete_softwarechannel_addrepo(self, text, line, beg, end):
+ parts = line.split(' ')
+
+ if len(parts) == 2:
+ return tab_completer(self.do_softwarechannel_list('', True),
+ text)
+ elif len(parts) == 3:
+ return tab_completer(self.do_repo_list('', True), text)
+
+def do_softwarechannel_addrepo(self, args):
+ (args, options) = parse_arguments(args)
+
+ if len(args) < 2:
+ self.help_softwarechannel_addrepo()
+ return
+
+ channel = args[0]
+ repo = args[1]
+
+ self.client.channel.software.associateRepo(self.session, channel, repo)
+
# vim:ts=4:expandtab:
commit 6255363ec7ca0028d1934057d9bf8f81d156857f
Author: Aron Parsons <aronparsons(a)gmail.com>
Date: Thu Dec 5 19:17:56 2013 -0500
spacecmd: fix tab completion for repo_addfilters
diff --git a/spacecmd/src/lib/repo.py b/spacecmd/src/lib/repo.py
index d6951a1..20a2065 100644
--- a/spacecmd/src/lib/repo.py
+++ b/spacecmd/src/lib/repo.py
@@ -100,7 +100,9 @@ def help_repo_addfilters(self):
print 'usage: repo_addfilters repo <filter ...>'
def complete_repo_addfilters(self, text, line, beg, end):
- return tab_completer(self.do_repo_add('', True), text)
+ if len(line.split(' ')) <= 2:
+ return tab_completer(self.do_repo_list('', True),
+ text)
def do_repo_addfilters(self, args):
# arguments can start with -, so don't parse arguments in the normal way