rel-eng/packages/spacecmd | 2 -
spacecmd/spacecmd.spec | 6 +++-
spacecmd/src/lib/repo.py | 69 ++++++++++++++++++++++++++++++++++++++++++++++
spacecmd/src/lib/shell.py | 6 ++--
4 files changed, 78 insertions(+), 5 deletions(-)
New commits:
commit 9b949f3ad4011e67135e9045d5e801346577785a
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Mon Mar 28 15:47:54 2011 -0400
Automatic commit of package [spacecmd] release [1.4.5-1].
diff --git a/rel-eng/packages/spacecmd b/rel-eng/packages/spacecmd
index a641560..02b6e52 100644
--- a/rel-eng/packages/spacecmd
+++ b/rel-eng/packages/spacecmd
@@ -1 +1 @@
-1.4.4-1 spacecmd/
+1.4.5-1 spacecmd/
diff --git a/spacecmd/spacecmd.spec b/spacecmd/spacecmd.spec
index 0302479..9e365ec 100644
--- a/spacecmd/spacecmd.spec
+++ b/spacecmd/spacecmd.spec
@@ -4,7 +4,7 @@
%endif
Name: spacecmd
-Version: 1.4.4
+Version: 1.4.5
Release: 1%{?dist}
Summary: Command-line interface to Spacewalk and Satellite servers
@@ -61,6 +61,10 @@ touch %{buildroot}/%{python_sitelib}/spacecmd/__init__.py
%doc %{_mandir}/man1/spacecmd.1.gz
%changelog
+* Mon Mar 28 2011 Aron Parsons <aparsons(a)redhat.com> 1.4.5-1
+- added 'repo' module into shell (aparsons(a)redhat.com)
+- added repo_list and repo_details (tljohnsn(a)oreillyschool.com)
+
* Fri Mar 11 2011 Aron Parsons <aparsons(a)redhat.com> 1.4.4-1
- added configchannel_verifyfile (aparsons(a)redhat.com)
commit 5af978607aff41ff991c1df234e13555dbc0e133
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Mon Mar 28 15:44:08 2011 -0400
spacecmd: added 'repo' module into shell
diff --git a/spacecmd/src/lib/shell.py b/spacecmd/src/lib/shell.py
index 4d362fc..c95655b 100644
--- a/spacecmd/src/lib/shell.py
+++ b/spacecmd/src/lib/shell.py
@@ -28,7 +28,7 @@ class SpacewalkShell(Cmd):
__module_list = [ 'activationkey', 'configchannel',
'cryptokey',
'custominfo', 'distribution', 'errata',
'filepreservation', 'group', 'kickstart',
- 'misc', 'org', 'package', 'report',
'schedule',
+ 'misc', 'org', 'package', 'repo',
'report', 'schedule',
'snippet', 'softwarechannel', 'ssm',
'system', 'user', 'utils' ]
@@ -65,7 +65,7 @@ class SpacewalkShell(Cmd):
# this is used when loading and saving caches
self.conf_dir = conf_dir
-
+
self.history_file = os.path.join(self.conf_dir, 'history')
try:
@@ -112,7 +112,7 @@ class SpacewalkShell(Cmd):
if not self.session:
self.do_login('')
if self.session == '': return ''
-
+
parts = line.split()
if len(parts):
commit 21849b9a06763faad27724a86e9ae076e1fbb2cc
Author: Trent Johnson <tljohnsn(a)oreillyschool.com>
Date: Mon Mar 28 15:43:35 2011 -0400
spacecmd: added repo_list and repo_details
diff --git a/spacecmd/src/lib/repo.py b/spacecmd/src/lib/repo.py
new file mode 100644
index 0000000..c2f50b1
--- /dev/null
+++ b/spacecmd/src/lib/repo.py
@@ -0,0 +1,69 @@
+#
+# Licensed under the GNU General Public License Version 3
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Copyright 2011 Aron Parsons <aron(a)redhat.com>
+#
+
+# NOTE: the 'self' variable is an instance of SpacewalkShell
+
+from spacecmd.utils import *
+
+def help_repo_list(self):
+ print 'repo_list: List all available user repos'
+ print 'usage: repo_list'
+
+def do_repo_list(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_repo_details(self):
+ print 'repo_details: Show the details of a user repo'
+ print 'usage: repo_details <repo ...>'
+
+def complete_repo_details(self, text, line, beg, end):
+ return tab_completer(self.do_repo_list('', True), text)
+
+def do_repo_details(self, args):
+ (args, options) = parse_arguments(args)
+
+ if not len(args):
+ self.help_repo_details()
+ return
+
+ # allow globbing of repo names
+ repos = filter_results(self.do_repo_list('', 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')