rel-eng/packages/spacecmd | 2
spacecmd/spacecmd.spec | 35 ++
spacecmd/src/doc/spacecmd.1 | 13 +
spacecmd/src/lib/activationkey.py | 146 +++++++----
spacecmd/src/lib/configchannel.py | 53 ++--
spacecmd/src/lib/cryptokey.py | 70 ++++-
spacecmd/src/lib/custominfo.py | 6
spacecmd/src/lib/distribution.py | 191 +++++++--------
spacecmd/src/lib/errata.py | 14 -
spacecmd/src/lib/filepreservation.py | 6
spacecmd/src/lib/group.py | 12
spacecmd/src/lib/kickstart.py | 431 ++++++++++++++++++++---------------
spacecmd/src/lib/misc.py | 9
spacecmd/src/lib/package.py | 8
spacecmd/src/lib/report.py | 8
spacecmd/src/lib/schedule.py | 13 -
spacecmd/src/lib/shell.py | 1
spacecmd/src/lib/snippet.py | 68 +++--
spacecmd/src/lib/softwarechannel.py | 194 +++++++++++----
spacecmd/src/lib/ssm.py | 6
spacecmd/src/lib/system.py | 281 ++++++++++++++--------
spacecmd/src/lib/user.py | 116 ++++++---
spacecmd/src/lib/utils.py | 30 ++
23 files changed, 1084 insertions(+), 629 deletions(-)
New commits:
commit 414f635ce7831c46e82bc0575fa6f33a676b6dfd
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Sep 23 19:17:29 2010 -0400
Automatic commit of package [spacecmd] release [0.7.1-1].
diff --git a/rel-eng/packages/spacecmd b/rel-eng/packages/spacecmd
index 9f79387..53f5d1e 100644
--- a/rel-eng/packages/spacecmd
+++ b/rel-eng/packages/spacecmd
@@ -1 +1 @@
-0.6.2-1 spacecmd/
+0.7.1-1 spacecmd/
diff --git a/spacecmd/spacecmd.spec b/spacecmd/spacecmd.spec
index 63a23d0..3d380a5 100644
--- a/spacecmd/spacecmd.spec
+++ b/spacecmd/spacecmd.spec
@@ -4,7 +4,7 @@
%endif
Name: spacecmd
-Version: 0.6.2
+Version: 0.7.1
Release: 1%{?dist}
Summary: Command-line interface to Spacewalk and Satellite servers
@@ -57,6 +57,39 @@ touch %{buildroot}/%{python_sitelib}/spacecmd/__init__.py
%doc %{_mandir}/man1/spacecmd.1.gz
%changelog
+* Thu Sep 23 2010 Aron Parsons <aparsons(a)redhat.com> 0.7.1-1
+- allow configchannel_create to be called non-interactively
+ (aparsons(a)redhat.com)
+- updated man page to explain how to run non-interactive commands
+ (aparsons(a)redhat.com)
+- allow softwarechannel_* functions to be called non-interactively
+ (aparsons(a)redhat.com)
+- allow system_* functions to be called non-interactively
+ (aparsons(a)redhat.com)
+- more fixes for ignorning the '-y' command-line option when it's not
+ applicable (aparsons(a)redhat.com)
+- allow user_* functions to be called non-interactively
+ (aparsons(a)redhat.com)
+- don't honor the '-y' command-line option when user_confirm isn't
+ used as a confirmation (aparsons(a)redhat.com)
+- allow snippet_* functions to be called non-interactively
+ (aparsons(a)redhat.com)
+- remove a comment about a fix that was committed ages ago
+ (aparsons(a)redhat.com)
+- allow kickstart_* functions to be called non-interactively
+ (aparsons(a)redhat.com)
+- allow distribution_* functions to be called non-interactively
+ (aparsons(a)redhat.com)
+- allow cryptokey_* functions to be called non-interactively
+ (aparsons(a)redhat.com)
+- added a function to read files (aparsons(a)redhat.com)
+- allow activationkey_* functions to be called non-interactively
+ (aparsons(a)redhat.com)
+- added function to test if the called function is interactive
+ (aparsons(a)redhat.com)
+- support for named arguments in utils.parse_arguments()
+ (aparsons(a)redhat.com)
+
* Tue Sep 21 2010 Aron Parsons <aparsons(a)redhat.com> 0.6.2-1
- added new function softwarechannel_removeerrata
(aparsons(a)redhat.com)
commit 16bf39df5c3f932f8eb16ecb85b410ccf25ff642
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Sep 23 19:16:34 2010 -0400
spacecmd: allow configchannel_create to be called non-interactively
diff --git a/spacecmd/src/lib/configchannel.py b/spacecmd/src/lib/configchannel.py
index 1f3a996..2968f78 100644
--- a/spacecmd/src/lib/configchannel.py
+++ b/spacecmd/src/lib/configchannel.py
@@ -20,6 +20,7 @@
# NOTE: the 'self' variable is an instance of SpacewalkShell
+from optparse import Option
from spacecmd.utils import *
def help_configchannel_list(self):
@@ -217,31 +218,35 @@ def do_configchannel_details(self, args):
def help_configchannel_create(self):
print 'configchannel_create: Create a configuration channel'
- print 'usage: configchannel_create [NAME] [DESCRIPTION]'
+ print '''usage: configchannel_create [options]
+
+options:
+ -n NAME
+ -d DESCRIPTION'''
def do_configchannel_create(self, args):
- (args, options) = parse_arguments(args)
+ options = [ Option('-n', '--name', action='store'),
+ Option('-d', '--description', action='store') ]
- if len(args) > 0:
- name = args[0]
- else:
- name = ''
+ (args, options) = parse_arguments(args, options)
- while name == '':
- name = prompt_user('Name:')
+ if is_interactive(options):
+ options.name = prompt_user('Name:', noblank = True)
+ options.description = prompt_user('Description:')
- if len(args) > 1:
- description = ' '.join(args[1:])
+ if options.description == '': options.description = options.name
else:
- description = prompt_user('Description:')
+ if not options.name:
+ logging.error('A name is required')
+ return
- if description == '':
- description = name
+ if not options.description:
+ options.description = options.name
self.client.configchannel.create(self.session,
- name,
- name,
- description)
+ options.name,
+ options.name,
+ options.description)
####################
commit 11311355679ec7b90ffabb88129434019e1ded4b
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Sep 23 19:07:45 2010 -0400
spacecmd: updated man page to explain how to run non-interactive commands
diff --git a/spacecmd/src/doc/spacecmd.1 b/spacecmd/src/doc/spacecmd.1
index 7673322..ef6328d 100644
--- a/spacecmd/src/doc/spacecmd.1
+++ b/spacecmd/src/doc/spacecmd.1
@@ -19,6 +19,19 @@ Run 'spacecmd help' to list the actions that are availble.
Run 'spacecmd help <command>' to get help for a particular command.
.fi
+.SH RUNNING SINGLE COMMANDS
+When running spacecmd non-interactively, you must take care to escape
+arguments passed to the spacecmd functions. This involves putting a '--'
+before the command starts so that the arguments to the function are not
+treated as global arguments to spacecmd. You must also escape any quotes
+that you pass to the functions so that the shell does not interpret them.
+.P
+.B Example:
+.nf
+spacecmd -s server1 -- softwarechannel_create -n \\'My Channel\\' \\
+ -l channel1 \\
+ -a x86_64
+.fi
.SH OPTIONS
.TP
.B \-u USERNAME, \-\-username=USERNAME
commit b06668560d2fd97aa10b2d5758d0cae9487ce077
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Sep 23 18:56:54 2010 -0400
spacecmd: allow softwarechannel_* functions to be called non-interactively
diff --git a/spacecmd/src/lib/softwarechannel.py b/spacecmd/src/lib/softwarechannel.py
index 2d9366b..9b1dfbd 100644
--- a/spacecmd/src/lib/softwarechannel.py
+++ b/spacecmd/src/lib/softwarechannel.py
@@ -21,6 +21,7 @@
# NOTE: the 'self' variable is an instance of SpacewalkShell
from operator import itemgetter
+from optparse import Option
from spacecmd.utils import *
ARCH_LABELS = ['ia32', 'ia64', 'x86_64', 'ppc',
@@ -346,73 +347,149 @@ def do_softwarechannel_delete(self, args):
def help_softwarechannel_create(self):
print 'softwarechannel_create: Create a software channel'
- print 'usage: softwarechannel_create'
+ print '''usage: softwarechannel_create [options]
+
+options:
+ -n NAME
+ -l LABEL
+ -p PARENT_CHANNEL
+ -a ARCHITECTURE ['ia32', 'ia64', 'x86_64', 'ppc',
+ 'i386-sun-solaris',
'sparc-sun-solaris']'''
def do_softwarechannel_create(self, args):
- name = prompt_user('Channel Name:', noblank = True)
- label = prompt_user('Channel Label:', noblank = True)
- summary = name
+ options = [ Option('-n', '--name', action='store'),
+ Option('-l', '--label', action='store'),
+ Option('-p', '--parent-channel',
action='store'),
+ Option('-a', '--arch', action='store') ]
- print 'Base Channels'
- print '-------------'
- print '\n'.join(sorted(self.list_base_channels()))
- print
+ (args, options) = parse_arguments(args, options)
- parent = \
- prompt_user('Select Parent [blank to create a base channel]:')
+ if is_interactive(options):
+ options.name = prompt_user('Channel Name:', noblank = True)
+ options.label = prompt_user('Channel Label:', noblank = True)
- print
- print 'Architecture'
- print '------------'
- print '\n'.join(sorted(self.ARCH_LABELS))
- print
- arch = prompt_user('Select:')
+ print 'Base Channels'
+ print '-------------'
+ print '\n'.join(sorted(self.list_base_channels()))
+ print
+
+ options.parent_channel = \
+ prompt_user('Select Parent [blank to create a base channel]:')
+
+ print
+ print 'Architecture'
+ print '------------'
+ print '\n'.join(sorted(self.ARCH_LABELS))
+ print
+ options.arch = prompt_user('Select:')
+ else:
+ if not options.name:
+ logging.error('A channel name is required')
+ return
+
+ if not options.label:
+ logging.error('A channel label is required')
+ return
+
+ if not options.arch:
+ logging.error('An architecture is required')
+ return
+
+ # default to make this a base channel
+ if not options.parent_channel:
+ options.parent_channel = ''
self.client.channel.software.create(self.session,
- label,
- name,
- summary,
- 'channel-%s' % arch,
- parent)
+ options.label,
+ options.name,
+ options.name, # summary
+ 'channel-%s' % options.arch,
+ options.parent_channel)
####################
def help_softwarechannel_clone(self):
print 'softwarechannel_clone: Clone a software channel'
- print 'usage: softwarechannel_clone SOURCE'
-
-def complete_softwarechannel_clone(self, text, line, beg, end):
- return tab_completer(self.do_softwarechannel_list('', True), text)
+ print '''usage: softwarechannel_clone [options]
+
+options:
+ -s SOURCE_CHANNEL
+ -n NAME
+ -l LABEL
+ -p PARENT_CHANNEL
+ --gpg-url GPG_URL
+ --gpg-id GPG_ID
+ --gpg-fingerprint GPG_FINGERPRINT
+ -o do not clone any errata'''
def do_softwarechannel_clone(self, args):
- (args, options) = parse_arguments(args)
+ options = [ Option('-n', '--name', action='store'),
+ Option('-l', '--label', action='store'),
+ Option('-s', '--source-channel',
action='store'),
+ Option('-p', '--parent-channel',
action='store'),
+ Option('-o', '--original-state',
action='store_true'),
+ Option('', '--gpg-url', action='store'),
+ Option('', '--gpg-id', action='store'),
+ Option('', '--gpg-fingerprint', action='store')
]
+
+ (args, options) = parse_arguments(args, options)
+
+ if is_interactive(options):
+ print 'Source Channels:'
+ print '\n'.join(sorted(self.list_base_channels()))
+ print '\n'.join(sorted(self.list_child_channels()))
+
+ options.source_channel = prompt_user('Select source channel:',
+ noblank = True)
+
+ options.name = prompt_user('Channel Name:', noblank = True)
+ options.label= prompt_user('Channel Label:', noblank = True)
+
+ print 'Base Channels:'
+ print '\n'.join(sorted(self.list_base_channels()))
+ print
- if not len(args):
- self.help_softwarechannel_clone()
- return
+ options.parent_channel = \
+ prompt_user('Select Parent [blank to create a base channel]:')
- source = args[0]
+ options.gpg_url = prompt_user('GPG URL:')
+ options.gpg_id = prompt_user('GPG ID:')
+ options.gpg_fingerprint = prompt_user('GPG Fingerprint:')
- details = {}
+ options.original_state = \
+ self.user_confirm('Original State (No Errata) [y/N]:',
+ ignore_yes = True)
+ else:
+ if not options.source_channel:
+ logging.error('A source channel is required')
+ return
- details['name'] = prompt_user('Channel Name:', noblank = True)
- details['label'] = prompt_user('Channel Label:', noblank = True)
- details['summary'] = details['name']
- details['description'] = details['name']
+ if not options.name:
+ logging.error('A channel name is required')
+ return
- print 'Base Channels:'
- print '\n'.join(sorted(self.list_base_channels()))
- print
+ if not options.label:
+ logging.error('A channel label is required')
+ return
+
+ if not options.original_state:
+ options.original_state = False
+
+ details = { 'name' : options.name,
+ 'label' : options.label,
+ 'summary' : options.name }
+
+ if options.parent_channel:
+ details['parent_label'] = options.parent_channel
- details['parent_label'] = \
- prompt_user('Select Parent [blank to create a base channel]:')
+ if options.gpg_id:
+ details['gpg_id'] = options.gpg_id
- details['gpg_url'] = prompt_user('GPG URL:')
- details['gpg_id'] = prompt_user('GPG ID:')
- details['gpg_fingerprint'] = prompt_user('GPG Fingerprint:')
+ if options.gpg_url:
+ details['gpg_url'] = options.gpg_url
- orig_state = self.user_confirm('Original State (No Errata) [y/N]:',
- ignore_yes = True)
+ if options.gpg_fingerprint:
+ details['gpg_fingerprint'] = options.gpg_fingerprint
# remove empty strings from the structure
to_remove = []
@@ -424,9 +501,9 @@ def do_softwarechannel_clone(self, args):
del details[key]
self.client.channel.software.clone(self.session,
- source,
+ options.source_channel,
details,
- orig_state)
+ options.original_state)
####################
commit 332466ff894c68de02b937c42b766fa1e5f2c85e
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Sep 23 18:23:30 2010 -0400
spacecmd: allow system_* functions to be called non-interactively
diff --git a/spacecmd/src/lib/system.py b/spacecmd/src/lib/system.py
index f8e8f4a..2f270c5 100644
--- a/spacecmd/src/lib/system.py
+++ b/spacecmd/src/lib/system.py
@@ -22,6 +22,7 @@
import shlex
from operator import itemgetter
+from optparse import Option
from xml.parsers.expat import ExpatError
from spacecmd.utils import *
@@ -271,7 +272,14 @@ def do_system_search(self, args, doreturn=False):
def help_system_runscript(self):
print 'system_runscript: Schedule a script to run on the list of'
print ' systems provided'
- print 'usage: system_runscript <SYSTEMS>'
+ print '''usage: system_runscript <SYSTEMS> [options]
+
+options:
+ -u USER
+ -g GROUP
+ -t TIMEOUT
+ -s START_TIME
+ -f FILE'''
print
print self.HELP_SYSTEM_OPTS
print
@@ -281,7 +289,13 @@ def complete_system_runscript(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_runscript(self, args):
- (args, options) = parse_arguments(args)
+ options = [ Option('-u', '--user', action='store'),
+ Option('-g', '--group', action='store'),
+ Option('-t', '--timeout', action='store'),
+ Option('-s', '--start-time', action='store'),
+ Option('-f', '--file', action='store') ]
+
+ (args, options) = parse_arguments(args, options)
if not len(args):
self.help_system_runscript()
@@ -297,60 +311,64 @@ def do_system_runscript(self, args):
logging.warning('No systems selected')
return
- user = prompt_user('User [root]:')
- group = prompt_user('Group [root]:')
+ if is_interactive(options):
+ options.user = prompt_user('User [root]:')
+ options.group = prompt_user('Group [root]:')
- # defaults
- if not user: user = 'root'
- if not group: group = 'root'
+ # defaults
+ if not options.user: options.user = 'root'
+ if not options.group: options.group = 'root'
- try:
- timeout = prompt_user('Timeout (in seconds) [600]:')
- if timeout:
- timeout = int(timeout)
- else:
- timeout = 600
- except ValueError:
- logging.error('Invalid timeout')
- return
+ try:
+ options.timeout = prompt_user('Timeout (in seconds) [600]:')
+ if options.timeout:
+ options.timeout = int(options.timeout)
+ else:
+ options.timeout = 600
+ except ValueError:
+ logging.error('Invalid timeout')
+ return
- timestamp = prompt_user('Start Time [now]:')
- timestamp = parse_time_input(timestamp)
+ options.start_time = prompt_user('Start Time [now]:')
+ options.start_time = parse_time_input(options.start_time)
- script_file = prompt_user('Script File [create]:')
+ script_file = prompt_user('Script File [create]:')
- # read the script provided by the user
- if script_file:
- keep_script_file = True
+ # read the script provided by the user
+ if script_file:
+ keep_script_file = True
- script_file = os.path.abspath(script_file)
+ options.script = read_file(os.path.abspath(script_file))
+ else:
+ # have the user write their script
+ (options.script, script_file) = editor('#!/bin/bash')
+ keep_script_file = False
- try:
- handle = open(script_file, 'r')
- script = handle.read()
- handle.close()
- except IOError:
- logging.error('Could not read %s' % script_file)
+ if not options.script:
+ logging.error('No script provided')
return
else:
- # have the user write their script
- (script, script_file) = editor('#!/bin/bash')
- keep_script_file = False
+ if not options.user: options.user = 'root'
+ if not options.group: options.group = 'root'
+ if not options.timeout: options.timeout = 600
+ if not options.start_time: options.start_time = parse_time_input('now')
- if not script:
- logging.error('No script provided')
- return
+ if not options.file:
+ logging.error('A script file is required')
+ return
+
+ options.script = read_file(options.file)
# display a summary
print
- print 'User: %s' % user
- print 'Group: %s' % group
- print 'Timeout: %i seconds' % timeout
- print 'Start Time: %s' % timestamp
+ print 'User: %s' % options.user
+ print 'Group: %s' % options.group
+ print 'Timeout: %i seconds' % options.timeout
+ print 'Start Time: %s' % options.start_time
print
print 'Script Contents'
print '---------------'
- print script
+ print options.script
# have the user confirm
if not self.user_confirm(): return
@@ -365,11 +383,11 @@ def do_system_runscript(self, args):
action_id = self.client.system.scheduleScriptRun(self.session,
system_ids,
- user,
- group,
- timeout,
- script,
- timestamp)
+ options.user,
+ options.group,
+ options.timeout,
+ options.script,
+ options.start_time)
logging.info('Action ID: %i' % action_id)
scheduled = len(system_ids)
@@ -381,13 +399,14 @@ def do_system_runscript(self, args):
if not system_id: return
try:
- action_id = self.client.system.scheduleScriptRun(self.session,
- system_id,
- user,
- group,
- timeout,
- script,
- timestamp)
+ action_id = \
+ self.client.system.scheduleScriptRun(self.session,
+ system_id,
+ options.user,
+ options.group,
+ options.timeout,
+ options.script,
+ options.start_time)
logging.info('Action ID: %i' % action_id)
scheduled += 1
@@ -979,7 +998,11 @@ def do_system_listconfigchannels(self, args):
def help_system_addconfigchannels(self):
print 'system_addconfigchannels: Add config channels to a system'
- print 'usage: system_addconfigchannels <SYSTEMS> <CHANNEL ...>'
+ print '''usage: system_addconfigchannels <SYSTEMS> <CHANNEL
...> [options]
+
+options:
+ -t add channels to the top of the list
+ -b add channels to the bottom of the list'''
print
print self.HELP_SYSTEM_OPTS
@@ -993,7 +1016,10 @@ def complete_system_addconfigchannels(self, text, line, beg, end):
text)
def do_system_addconfigchannels(self, args):
- (args, options) = parse_arguments(args)
+ options = [ Option('-t', '--top', action='store_true'),
+ Option('-b', '--bottom', action='store_true') ]
+
+ (args, options) = parse_arguments(args, options)
if len(args) < 2:
self.help_system_addconfigchannels()
@@ -1008,18 +1034,24 @@ def do_system_addconfigchannels(self, args):
channels = args
- answer = prompt_user('Add to top or bottom? [T/b]:')
- if re.match('b', answer, re.I):
- location = False
+ if is_interactive(options):
+ answer = prompt_user('Add to top or bottom? [T/b]:')
+ if re.match('b', answer, re.I):
+ options.top = False
+ else:
+ options.top = True
else:
- location = True
+ if options.bottom:
+ options.top = False
+ else:
+ options.top = True
system_ids = [ self.get_system_id(s) for s in systems ]
self.client.system.config.addChannels(self.session,
system_ids,
channels,
- location)
+ options.top)
####################
@@ -1480,7 +1512,11 @@ def do_system_removecustomvalues(self, args):
def help_system_addnote(self):
print 'system_addnote: Set a note for a system'
- print 'usage: system_addnote <SYSTEM>'
+ print '''usage: system_addnote <SYSTEM> [options]
+
+options:
+ -s SUBJECT
+ -b BODY'''
print
print self.HELP_SYSTEM_OPTS
@@ -1488,7 +1524,10 @@ def complete_system_addnote(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_addnote(self, args):
- (args, options) = parse_arguments(args)
+ options = [ Option('-s', '--subject', action='store'),
+ Option('-b', '--body', action='store') ]
+
+ (args, options) = parse_arguments(args, options)
if len(args) < 1:
self.help_system_addnote()
@@ -1500,16 +1539,28 @@ def do_system_addnote(self, args):
else:
systems = self.expand_systems(args)
- subject = prompt_user('Subject of the Note:', noblank = True)
+ if is_interactive(options):
+ options.subject = prompt_user('Subject of the Note:', noblank = True)
+
+ message = 'Note Body (ctrl-D to finish):'
+ options.body = prompt_user(message, noblank = True, multiline = True)
+ else:
+ if not options.subject:
+ logging.error('A subject is required')
+ return
- message = 'Note Body (ctrl-D to finish):'
- body = prompt_user(message, noblank = True, multiline = True)
+ if not options.body:
+ logging.error('A body is required')
+ return
for system in systems:
system_id = self.get_system_id(system)
if not system_id: continue
- self.client.system.addNote(self.session, system_id, subject, body)
+ self.client.system.addNote(self.session,
+ system_id,
+ options.subject,
+ options.body)
####################
@@ -2211,7 +2262,11 @@ def do_system_deletepackageprofile(self, args):
def help_system_createpackageprofile(self):
print 'system_createpackageprofile: Create a package profile'
- print 'usage: system_createpackageprofile SYSTEM'
+ print '''usage: system_createpackageprofile SYSTEM [options]
+
+options:
+ -n NAME
+ -d DESCRIPTION'''
def complete_system_createpackageprofile(self, text, line, beg, end):
parts = line.split(' ')
@@ -2220,7 +2275,10 @@ def complete_system_createpackageprofile(self, text, line, beg,
end):
return self.tab_complete_systems(text)
def do_system_createpackageprofile(self, args):
- (args, options) = parse_arguments(args)
+ options = [ Option('-n', '--name', action='store'),
+ Option('-d', '--description', action='store') ]
+
+ (args, options) = parse_arguments(args, options)
if len(args) != 1:
self.help_system_createpackageprofile()
@@ -2231,15 +2289,24 @@ def do_system_createpackageprofile(self, args):
logging.error('Invalid system')
return
- label = prompt_user('Profile Label:', noblank = True)
- description = prompt_user('Description:', multiline = True)
+ if is_interactive(options):
+ options.name = prompt_user('Profile Label:', noblank = True)
+ options.description = prompt_user('Description:', multiline = True)
+ else:
+ if not options.name:
+ logging.error('A profile name is required')
+ return
+
+ if not options.description:
+ logging.error('A profile description is required')
+ return
results = self.client.system.createPackageProfile(self.session,
system_id,
- label,
- description)
+ options.name,
+ options.description)
- logging.info("Created package profile '%s'" % label)
+ logging.info("Created package profile '%s'" % options.name)
####################
commit cff47750f3fadb44b0f782cf247e9cdfe93025c9
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Sep 23 17:57:09 2010 -0400
spacecmd: more fixes for ignorning the '-y' command-line option when it's
not applicable
diff --git a/spacecmd/src/lib/activationkey.py b/spacecmd/src/lib/activationkey.py
index 6cad8b7..740ac30 100644
--- a/spacecmd/src/lib/activationkey.py
+++ b/spacecmd/src/lib/activationkey.py
@@ -607,10 +607,12 @@ def do_activationkey_create(self, args):
for e in self.ENTITLEMENTS:
if e == 'enterprise_entitled': continue
- if self.user_confirm('%s Entitlement [y/N]:' % e):
+ if self.user_confirm('%s Entitlement [y/N]:' % e,
+ ignore_yes = True):
options.entitlements.append(e)
- options.universal = self.user_confirm('Universal Default [y/N]:')
+ options.universal = self.user_confirm('Universal Default [y/N]:',
+ ignore_yes = True)
else:
if not options.name: options.name = ''
if not options.description: options.description = ''
diff --git a/spacecmd/src/lib/cryptokey.py b/spacecmd/src/lib/cryptokey.py
index e067e70..5adf637 100644
--- a/spacecmd/src/lib/cryptokey.py
+++ b/spacecmd/src/lib/cryptokey.py
@@ -46,7 +46,8 @@ def do_cryptokey_create(self, args):
while options.description == '':
options.description = prompt_user('Description:')
- if self.user_confirm('Read an existing file [y/N]:', nospacer = True):
+ if self.user_confirm('Read an existing file [y/N]:',
+ nospacer = True, ignore_yes = True):
options.file = prompt_user('File:')
else:
options.contents = editor(delete=True)
diff --git a/spacecmd/src/lib/kickstart.py b/spacecmd/src/lib/kickstart.py
index 78c082a..94e42cc 100644
--- a/spacecmd/src/lib/kickstart.py
+++ b/spacecmd/src/lib/kickstart.py
@@ -1624,7 +1624,8 @@ def do_kickstart_addscript(self, args):
options.interpreter = prompt_user('Interpreter [/bin/bash]:')
# get the contents of the script
- if self.user_confirm('Read an existing file [y/N]:', nospacer = True):
+ if self.user_confirm('Read an existing file [y/N]:',
+ nospacer = True, ignore_yes = True):
options.file = prompt_user('File:')
else:
(options.contents, ignore) = editor(delete=True)
diff --git a/spacecmd/src/lib/snippet.py b/spacecmd/src/lib/snippet.py
index 7d0562f..7d0280a 100644
--- a/spacecmd/src/lib/snippet.py
+++ b/spacecmd/src/lib/snippet.py
@@ -109,7 +109,8 @@ def do_snippet_create(self, args, update_name = ''):
if not options.name:
options.name = prompt_user('Name:', noblank = True)
- if self.user_confirm('Read an existing file [y/N]:', nospacer = True):
+ if self.user_confirm('Read an existing file [y/N]:',
+ nospacer = True, ignore_yes = True):
options.file = prompt_user('File:')
else:
if not options.contents: options.contents = ''
diff --git a/spacecmd/src/lib/softwarechannel.py b/spacecmd/src/lib/softwarechannel.py
index 526c084..2d9366b 100644
--- a/spacecmd/src/lib/softwarechannel.py
+++ b/spacecmd/src/lib/softwarechannel.py
@@ -411,7 +411,8 @@ def do_softwarechannel_clone(self, args):
details['gpg_id'] = prompt_user('GPG ID:')
details['gpg_fingerprint'] = prompt_user('GPG Fingerprint:')
- orig_state = self.user_confirm('Original State (No Errata) [y/N]:')
+ orig_state = self.user_confirm('Original State (No Errata) [y/N]:',
+ ignore_yes = True)
# remove empty strings from the structure
to_remove = []
commit c9baf2f94270a38c0ae36df988e89fccee9f2028
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Sep 23 17:52:09 2010 -0400
spacecmd: allow user_* functions to be called non-interactively
diff --git a/spacecmd/src/lib/user.py b/spacecmd/src/lib/user.py
index 71d835a..15fb27b 100644
--- a/spacecmd/src/lib/user.py
+++ b/spacecmd/src/lib/user.py
@@ -22,41 +22,83 @@
import shlex
from getpass import getpass
+from optparse import Option
from spacecmd.utils import *
def help_user_create(self):
print 'user_create: Create a user'
- print 'usage: user_create'
+ print '''usage: user_create [options]
+
+options:
+ -u USERNAME
+ -f FIRST_NAME
+ -l LAST_NAME
+ -e EMAIL
+ -p PASSWORD
+ --pam enable PAM authentication'''
def do_user_create(self, args):
- username = prompt_user('Username:', noblank = True)
- first_name = prompt_user('First Name:', noblank = True)
- last_name = prompt_user('Last Name:', noblank = True)
- email = prompt_user('Email:', noblank = True)
- pam = self.user_confirm('PAM Authentication [y/N]:',
- nospacer = True,
- integer = True)
-
- password = ''
- while password == '':
- print
- password1 = getpass('Password: ')
- password2 = getpass('Repeat Password: ')
-
- if password1 == password2:
- password = password1
- elif password1 == '':
- logging.warning('Password must be at least 5 characters')
- else:
- logging.warning("Passwords don't match")
+ options = [ Option('-u', '--username', action='store'),
+ Option('-f', '--first-name', action='store'),
+ Option('-l', '--last-name', action='store'),
+ Option('-e', '--email', action='store'),
+ Option('-p', '--password', action='store'),
+ Option('', '--pam', action='store_true') ]
+
+ (args, options) = parse_arguments(args, options)
+
+ if is_interactive(options):
+ options.username = prompt_user('Username:', noblank = True)
+ options.first_name = prompt_user('First Name:', noblank = True)
+ options.last_name = prompt_user('Last Name:', noblank = True)
+ options.email = prompt_user('Email:', noblank = True)
+ options.pam = self.user_confirm('PAM Authentication [y/N]:',
+ nospacer = True,
+ integer = True,
+ ignore_yes = True)
+
+ options.password = ''
+ while options.password == '':
+ password1 = getpass('Password: ')
+ password2 = getpass('Repeat Password: ')
+
+ if password1 == password2:
+ options.password = password1
+ elif password1 == '':
+ logging.warning('Password must be at least 5 characters')
+ else:
+ logging.warning("Passwords don't match")
+ else:
+ if not options.username:
+ logging.error('A username is required')
+ return
+
+ if not options.first_name:
+ logging.error('A first name is required')
+ return
+
+ if not options.last_name:
+ logging.error('A last name is required')
+ return
+
+ if not options.email:
+ logging.error('An email address is required')
+ return
+
+ if not options.password:
+ logging.error('A password is required')
+ return
+
+ if not options.pam:
+ options.pam = 0
self.client.user.create(self.session,
- username,
- password,
- first_name,
- last_name,
- email,
- pam)
+ options.username,
+ options.password,
+ options.first_name,
+ options.last_name,
+ options.email,
+ options.pam)
####################
commit 4d28282c6ba03b271dfde4ae2038cf1d9fdfc1a9
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Sep 23 17:51:12 2010 -0400
spacecmd: don't honor the '-y' command-line option when user_confirm
isn't used as a confirmation
diff --git a/spacecmd/src/lib/misc.py b/spacecmd/src/lib/misc.py
index 4f35603..d364288 100644
--- a/spacecmd/src/lib/misc.py
+++ b/spacecmd/src/lib/misc.py
@@ -761,8 +761,11 @@ def list_child_channels(self, system=None, parent=None,
subscribed=False):
return [ c.get('label') for c in channels ]
-def user_confirm(self, prompt = 'Is this ok [y/N]:', nospacer = False, integer =
False):
- if self.options.yes: return True
+def user_confirm(self, prompt = 'Is this ok [y/N]:', nospacer = False,
+ integer = False, ignore_yes = False):
+
+ if self.options.yes and not ignore_yes:
+ return True
if nospacer:
answer = prompt_user('%s' % prompt)
commit 667a6fbab790c5969e643cf8204d4dd242142430
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Sep 23 17:35:29 2010 -0400
spacecmd: allow snippet_* functions to be called non-interactively
diff --git a/spacecmd/src/lib/snippet.py b/spacecmd/src/lib/snippet.py
index c0101e2..7d0562f 100644
--- a/spacecmd/src/lib/snippet.py
+++ b/spacecmd/src/lib/snippet.py
@@ -20,6 +20,7 @@
# NOTE: the 'self' variable is an instance of SpacewalkShell
+from optparse import Option
from spacecmd.utils import *
def help_snippet_list(self):
@@ -82,32 +83,60 @@ def do_snippet_details(self, args):
def help_snippet_create(self):
print 'snippet_create: Create a Kickstart snippet'
- print 'usage: snippet_create'
+ print '''usage: snippet_create [options]
-def do_snippet_create(self, args, name=''):
- (args, options) = parse_arguments(args)
+options:
+ -n NAME
+ -f FILE'''
- template = ''
- if name:
- snippets = self.client.kickstart.snippet.listCustom(self.session)
- for s in snippets:
- if s.get('name') == name:
- template = s.get('contents')
- break
+def do_snippet_create(self, args, update_name = ''):
+ options = [ Option('-n', '--name', action='store'),
+ Option('-f', '--file', action='store') ]
+
+ (args, options) = parse_arguments(args, options)
+
+ if is_interactive(options):
+ # if update_name was passed, we're trying to update an existing snippet
+ if update_name:
+ options.name = update_name
+
+ snippets = self.client.kickstart.snippet.listCustom(self.session)
+ for s in snippets:
+ if s.get('name') == update_name:
+ options.contents = s.get('contents')
+ break
+
+ if not options.name:
+ options.name = prompt_user('Name:', noblank = True)
+
+ if self.user_confirm('Read an existing file [y/N]:', nospacer = True):
+ options.file = prompt_user('File:')
+ else:
+ if not options.contents: options.contents = ''
+
+ (options.contents, ignore) = editor(template = options.contents,
+ delete=True)
else:
- name = prompt_user('Name:', noblank = True)
+ if not options.name:
+ logging.error('A name is required for the snippet')
+ return
+
+ if not options.file:
+ logging.error('A file is required')
+ return
- (contents, ignore) = editor(template = template, delete = True)
+ if options.file:
+ options.contents = read_file(options.file)
print
print 'Contents'
print '--------'
- print contents
+ print options.contents
if self.user_confirm():
self.client.kickstart.snippet.createOrUpdate(self.session,
- name,
- contents)
+ options.name,
+ options.contents)
####################
@@ -125,7 +154,7 @@ def do_snippet_update(self, args):
self.help_snippet_update()
return
- return self.do_snippet_create('', name=args[0])
+ return self.do_snippet_create('', update_name = args[0])
####################
commit 555160d628528188a49d386c1119e7889401aaf3
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Sep 23 17:19:01 2010 -0400
spacecmd: remove a comment about a fix that was committed ages ago
diff --git a/spacecmd/src/lib/schedule.py b/spacecmd/src/lib/schedule.py
index 163b4a2..efbbb94 100644
--- a/spacecmd/src/lib/schedule.py
+++ b/spacecmd/src/lib/schedule.py
@@ -23,9 +23,6 @@
from operator import itemgetter
from spacecmd.utils import *
-#XXX: list*Actions needs to return a struct with the number of
-# completed/failed/pending systems so we don't need to make
-# additional API calls to get those numbers
def print_schedule_summary(self, type, args):
(args, options) = parse_arguments(args)
commit 04377da90a63adc48445959844cadebd8974afd0
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Sep 23 17:16:11 2010 -0400
spacecmd: allow kickstart_* functions to be called non-interactively
diff --git a/spacecmd/src/lib/kickstart.py b/spacecmd/src/lib/kickstart.py
index 4ad6983..78c082a 100644
--- a/spacecmd/src/lib/kickstart.py
+++ b/spacecmd/src/lib/kickstart.py
@@ -22,6 +22,7 @@
from getpass import getpass
from operator import itemgetter
+from optparse import Option
from urllib2 import urlopen, HTTPError
from spacecmd.utils import *
@@ -56,58 +57,82 @@ def do_kickstart_list(self, args, doreturn=False):
def help_kickstart_create(self):
print 'kickstart_create: Create a Kickstart profile'
- print 'usage: kickstart_create [PROFILE]'
+ print '''usage: kickstart_create [options]
-def do_kickstart_create(self, args):
- (args, options) = parse_arguments(args)
+options:
+ -n NAME
+ -d DISTRIBUTION
+ -p ROOT_PASSWORD
+ -v VIRT_TYPE ['none', 'para_host', 'qemu', 'xenfv',
'xenpv']'''
- if len(args):
- name = args[0]
- else:
- name = prompt_user('Name:', noblank = True)
+def do_kickstart_create(self, args):
+ options = [ Option('-n', '--name', action='store'),
+ Option('-d', '--distribution', action='store'),
+ Option('-v', '--virt-type', action='store'),
+ Option('-p', '--root-password', action='store')
]
- print 'Virtualization Types'
- print '--------------------'
- print '\n'.join(sorted(self.VIRT_TYPES))
- print
+ (args, options) = parse_arguments(args, options)
- virt = prompt_user('Virtualization Type [none]:')
- if virt == '' or virt not in self.VIRT_TYPES:
- virt = 'none'
+ if is_interactive(options):
+ options.name = prompt_user('Name:', noblank = True)
- tree = ''
- while tree == '':
- trees = self.do_distribution_list('', True)
- print
- print 'Distributions'
- print '-------------'
- print '\n'.join(sorted(trees))
+ print 'Virtualization Types'
+ print '--------------------'
+ print '\n'.join(sorted(self.VIRT_TYPES))
print
- tree = prompt_user('Select:')
+ options.virt_type = prompt_user('Virtualization Type [none]:')
+ if options.virt_type == '' or options.virt_type not in self.VIRT_TYPES:
+ options.virt_type = 'none'
- password = ''
- while password == '':
- print
- password1 = getpass('Root Password: ')
- password2 = getpass('Repeat Password: ')
+ options.distribution = ''
+ while options.distribution == '':
+ trees = self.do_distribution_list('', True)
+ print
+ print 'Distributions'
+ print '-------------'
+ print '\n'.join(sorted(trees))
+ print
- if password1 == password2:
- password = password1
- elif password1 == '':
- logging.warning('Password must be at least 5 characters')
- else:
- logging.warning("Passwords don't match")
+ options.distribution = prompt_user('Select:')
+
+ options.root_password = ''
+ while options.root_password == '':
+ print
+ password1 = getpass('Root Password: ')
+ password2 = getpass('Repeat Password: ')
+
+ if password1 == password2:
+ root_options.password = password1
+ elif password1 == '':
+ logging.warning('Password must be at least 5 characters')
+ else:
+ logging.warning("Passwords don't match")
+ else:
+ if not options.name:
+ logging.error('The Kickstart name is required')
+ return
+
+ if not options.distribution:
+ logging.error('The distribution is required')
+ return
+
+ if not options.virt_type:
+ options.virt_type = 'none'
+
+ if not options.root_password:
+ logging.error('A root password is required')
+ return
# leave this blank to use the default server
host = ''
self.client.kickstart.createProfile(self.session,
- name,
- virt,
- tree,
+ options.name,
+ options.virt_type,
+ options.distribution,
host,
- password)
+ options.root_password)
####################
@@ -135,60 +160,75 @@ def do_kickstart_delete(self, args):
def help_kickstart_import(self):
print 'kickstart_import: Import a Kickstart profile from a file'
- print 'usage: kickstart_import PROFILE FILE'
+ print '''usage: kickstart_import PROFILE [options]
+
+options:
+ -f FILE
+ -n NAME
+ -d DISTRIBUTION
+ -p ROOT_PASSWORD
+ -v VIRT_TYPE ['none', 'para_host', 'qemu', 'xenfv',
'xenpv']'''
def do_kickstart_import(self, args):
- (args, options) = parse_arguments(args)
+ options = [ Option('-n', '--name', action='store'),
+ Option('-d', '--distribution', action='store'),
+ Option('-v', '--virt-type', action='store'),
+ Option('-p', '--root-password', action='store'),
+ Option('-f', '--file', action='store') ]
- if not len(args):
- self.help_kickstart_import()
- return
+ (args, options) = parse_arguments(args, options)
- name = args[0]
- filename = args[1]
+ if is_interactive(options):
+ options.name = prompt_user('Name:', noblank = True)
+ options.file = prompt_user('File:', noblank = True)
- print 'Virtualization Types'
- print '--------------------'
- print '\n'.join(sorted(self.VIRT_TYPES))
- print
+ print 'Virtualization Types'
+ print '--------------------'
+ print '\n'.join(sorted(self.VIRT_TYPES))
+ print
- virt = prompt_user('Virtualization Type [none]:')
- if virt == '' or virt not in self.VIRT_TYPES:
- virt = 'none'
+ options.virt_type = prompt_user('Virtualization Type [none]:')
+ if options.virt_type == '' or options.virt_type not in self.VIRT_TYPES:
+ options.virt_type = 'none'
- tree = ''
- while tree == '':
- trees = self.do_distribution_list('', True)
- print
- print 'Distributions'
- print '-------------'
- print '\n'.join(sorted(trees))
- print
+ options.distribution = ''
+ while options.distribution == '':
+ trees = self.do_distribution_list('', True)
+ print
+ print 'Distributions'
+ print '-------------'
+ print '\n'.join(sorted(trees))
+ print
- tree = prompt_user('Select:')
+ options.distribution = prompt_user('Select:')
+ else:
+ if not options.name:
+ logging.error('The Kickstart name is required')
+ return
- if not os.path.isfile(filename):
- logging.error("Couldn't read %s" % filename)
- return
+ if not options.distribution:
+ logging.error('The distribution is required')
+ return
- contents = ''
- try:
- ksfile = open(filename, 'r')
- contents = ksfile.read()
- ksfile.close()
- except IOError:
- logging.error("Couldn't read %s" % filename)
- return
+ if not options.file:
+ logging.error('A filename is required')
+ return
+
+ if not options.virt_type:
+ options.virt_type = 'none'
+
+ # read the contents of the Kickstart file
+ options.contents = read_file(options.file)
# use the default server
host = ''
self.client.kickstart.importFile(self.session,
- name,
- virt,
- tree,
+ options.name,
+ options.virt_type,
+ options.distribution,
host,
- contents)
+ options.contents)
####################
@@ -569,7 +609,7 @@ def complete_kickstart_addactivationkeys(self, text, line, beg, end):
if len(parts) == 2:
return tab_completer(self.do_kickstart_list('', True), text)
elif len(parts) > 2:
- return tab_completer(self.do_activationkey_list('', True),
+ return tab_completer(self.do_activationkey_list('', True),
text)
def do_kickstart_addactivationkeys(self, args):
@@ -594,7 +634,7 @@ def help_kickstart_removeactivationkeys(self):
'a Kickstart profile'
print 'usage: kickstart_removeactivationkeys PROFILE <KEY ...>'
-def complete_kickstart_removeactivationkeys(self, text, line, beg,
+def complete_kickstart_removeactivationkeys(self, text, line, beg,
end):
parts = line.split(' ')
@@ -633,7 +673,7 @@ def help_kickstart_enableconfigmanagement(self):
'management on a Kickstart profile'
print 'usage: kickstart_enableconfigmanagement PROFILE'
-def complete_kickstart_enableconfigmanagement(self, text, line, beg,
+def complete_kickstart_enableconfigmanagement(self, text, line, beg,
end):
parts = line.split(' ')
@@ -659,7 +699,7 @@ def help_kickstart_disableconfigmanagement(self):
'management on a Kickstart profile'
print 'usage: kickstart_disableconfigmanagement PROFILE'
-def complete_kickstart_disableconfigmanagement(self, text, line, beg,
+def complete_kickstart_disableconfigmanagement(self, text, line, beg,
end):
parts = line.split(' ')
@@ -685,7 +725,7 @@ def help_kickstart_enableremotecommands(self):
'on a Kickstart profile'
print 'usage: kickstart_enableremotecommands PROFILE'
-def complete_kickstart_enableremotecommands(self, text, line, beg,
+def complete_kickstart_enableremotecommands(self, text, line, beg,
end):
parts = line.split(' ')
@@ -730,7 +770,7 @@ def do_kickstart_disableremotecommands(self, args):
profile)
####################
-
+
def help_kickstart_setlocale(self):
print 'kickstart_setlocale: Set the locale for a Kickstart profile'
print 'usage: kickstart_setlocale PROFILE LOCALE'
@@ -753,7 +793,7 @@ def do_kickstart_setlocale(self, args):
profile = args[0]
locale = args[1]
- # always use UTC
+ # always use UTC
utc = True
self.client.kickstart.profile.system.setLocale(self.session,
@@ -835,7 +875,7 @@ def do_kickstart_setpartitions(self, args):
lines)
####################
-
+
def help_kickstart_setdistribution(self):
print 'kickstart_setdistribution: Set the distribution for a ' + \
'Kickstart profile'
@@ -864,7 +904,7 @@ def do_kickstart_setdistribution(self, args):
distribution)
####################
-
+
def help_kickstart_enablelogging(self):
print 'kickstart_enablelogging: Enable logging for a Kickstart profile'
print 'usage: kickstart_enablelogging PROFILE'
@@ -883,14 +923,14 @@ def do_kickstart_enablelogging(self, args):
return
profile = args[0]
-
+
self.client.kickstart.profile.setLogging(self.session,
profile,
True,
True)
####################
-
+
def help_kickstart_addvariable(self):
print 'kickstart_addvariable: Add a variable to a Kickstart profile'
print 'usage: kickstart_addvariable PROFILE KEY VALUE'
@@ -922,7 +962,7 @@ def do_kickstart_addvariable(self, args):
variables)
####################
-
+
def help_kickstart_updatevariable(self):
print 'kickstart_updatevariable: Update a variable in a Kickstart ' + \
'profile'
@@ -954,7 +994,7 @@ def do_kickstart_updatevariable(self, args):
return self.do_kickstart_addvariable(' '.join(args))
####################
-
+
def help_kickstart_removevariables(self):
print 'kickstart_removevariables: Remove variables from a ' + \
'Kickstart profile'
@@ -998,7 +1038,7 @@ def do_kickstart_removevariables(self, args):
variables)
####################
-
+
def help_kickstart_listvariables(self):
print 'kickstart_listvariables: List the variables of a Kickstart ' + \
'profile'
@@ -1026,7 +1066,7 @@ def do_kickstart_listvariables(self, args):
print '%s = %s' % (v, variables[v])
####################
-
+
def help_kickstart_addoption(self):
print 'kickstart_addoption: Set an option for a Kickstart profile'
print 'usage: kickstart_addoption PROFILE KEY [VALUE]'
@@ -1076,7 +1116,7 @@ def do_kickstart_addoption(self, args):
return
####################
-
+
def help_kickstart_removeoptions(self):
print 'kickstart_removeoptions: Remove options from a Kickstart profile'
print 'usage: kickstart_removeoptions PROFILE <OPTION ...>'
@@ -1122,7 +1162,7 @@ def do_kickstart_removeoptions(self, args):
advanced)
####################
-
+
def help_kickstart_listoptions(self):
print 'kickstart_listoptions: List the options of a Kickstart ' + \
'profile'
@@ -1151,7 +1191,7 @@ def do_kickstart_listoptions(self, args):
print '%s %s' % (o.get('name'), o.get('arguments'))
####################
-
+
def help_kickstart_listcustomoptions(self):
print 'kickstart_listcustomoptions: List the custom options of a ' + \
'Kickstart profile'
@@ -1180,7 +1220,7 @@ def do_kickstart_listcustomoptions(self, args):
print o.get('arguments')
####################
-
+
def help_kickstart_setcustomoptions(self):
print 'kickstart_setcustomoptions: Set custom options for a ' + \
'Kickstart profile'
@@ -1213,7 +1253,7 @@ def do_kickstart_setcustomoptions(self, args):
old_options = '\n'.join(old_options)
# let the user edit the custom options
- (new_options, ignore) = editor(template = old_options,
+ (new_options, ignore) = editor(template = old_options,
delete = True)
new_options = new_options.split('\n')
@@ -1223,7 +1263,7 @@ def do_kickstart_setcustomoptions(self, args):
new_options)
####################
-
+
def help_kickstart_addchildchannels(self):
print 'kickstart_addchildchannels: Add a child channels to a ' + \
'Kickstart profile'
@@ -1252,7 +1292,7 @@ def complete_kickstart_addchildchannels(self, text, line, beg,
end):
parent_channel = base_channel.get('label')
except:
return []
-
+
return tab_completer(self.list_child_channels(\
parent=parent_channel), text)
@@ -1270,19 +1310,19 @@ def do_kickstart_addchildchannels(self, args):
profile)
channels.extend(new_channels)
-
+
self.client.kickstart.profile.setChildChannels(self.session,
profile,
channels)
####################
-
+
def help_kickstart_removechildchannels(self):
print 'kickstart_removechildchannels: Remove child channels from ' + \
'a Kickstart profile'
print 'usage: kickstart_removechildchannels PROFILE <CHANNEL ...>'
-def complete_kickstart_removechildchannels(self, text, line, beg,
+def complete_kickstart_removechildchannels(self, text, line, beg,
end):
parts = line.split(' ')
@@ -1314,7 +1354,7 @@ def do_kickstart_removechildchannels(self, args):
channels)
####################
-
+
def help_kickstart_listchildchannels(self):
print 'kickstart_listchildchannels: List the child channels of a ' + \
'Kickstart profile'
@@ -1357,7 +1397,7 @@ def complete_kickstart_addfilepreservations(self, text, line, beg,
end):
if len(parts) == 2:
return tab_completer(self.do_kickstart_list('', True), text)
elif len(parts) == 3:
- return tab_completer(self.do_filepreservation_list('', True),
+ return tab_completer(self.do_filepreservation_list('', True),
text)
def do_kickstart_addfilepreservations(self, args):
@@ -1381,7 +1421,7 @@ def help_kickstart_removefilepreservations(self):
'preservations from a Kickstart profile'
print 'usage: kickstart_removefilepreservations PROFILE <FILE ...>'
-def complete_kickstart_removefilepreservations(self, text, line, beg,
+def complete_kickstart_removefilepreservations(self, text, line, beg,
end):
parts = line.split(' ')
@@ -1453,7 +1493,7 @@ def complete_kickstart_addpackages(self, text, line, beg, end):
parts = line.split(' ')
if len(parts) == 2:
- return tab_completer(self.do_kickstart_list('', True), text)
+ return tab_completer(self.do_kickstart_list('', True), text)
elif len(parts) > 2:
return tab_completer(self.get_package_names(), text)
@@ -1481,7 +1521,7 @@ def complete_kickstart_removepackages(self, text, line, beg, end):
parts = line.split(' ')
if len(parts) == 2:
- return tab_completer(self.do_kickstart_list('', True),
+ return tab_completer(self.do_kickstart_list('', True),
text)
elif len(parts) > 2:
return tab_completer(self.do_kickstart_listpackages(\
@@ -1549,7 +1589,14 @@ def do_kickstart_listscripts(self, args):
def help_kickstart_addscript(self):
print 'kickstart_addscript: Add a script to a Kickstart profile'
- print 'usage: kickstart_addscript PROFILE'
+ print '''usage: kickstart_addscript PROFILE [options]
+
+options:
+ -p PROFILE
+ -e EXECUTION_TIME ['pre', 'post']
+ -i INTERPRETER
+ -f FILE
+ -c execute in a chroot environment'''
def complete_kickstart_addscript(self, text, line, beg, end):
parts = line.split(' ')
@@ -1558,49 +1605,80 @@ def complete_kickstart_addscript(self, text, line, beg, end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_addscript(self, args):
- (args, options) = parse_arguments(args)
+ options = [ Option('-p', '--profile', action='store'),
+ Option('-e', '--execution-time',
action='store'),
+ Option('-c', '--chroot', action='store_true'),
+ Option('-i', '--interpreter', action='store'),
+ Option('-f', '--file', action='store') ]
- if not len(args):
- self.help_kickstart_addscript()
- return
+ (args, options) = parse_arguments(args, options)
- profile = args[0]
+ if is_interactive(options):
+ if len(args):
+ options.profile = args[0]
+ else:
+ options.profile = prompt_user('Profile Name:', noblank = True)
- script_type = prompt_user('Pre/Post Script [post]:')
- chroot = prompt_user('Chrooted [Y/n]:')
- interpreter = prompt_user('Interpreter [/bin/bash]:')
-
- # get the contents of the script
- (contents, ignore) = editor(delete = True)
-
- # check user input
- if interpreter == '': interpreter = '/bin/bash'
-
- if re.match('pre', script_type, re.I):
- script_type = 'pre'
- else:
- script_type = 'post'
+ options.execution_time = prompt_user('Pre/Post Script [post]:')
+ options.chroot = prompt_user('Chrooted [Y/n]:')
+ options.interpreter = prompt_user('Interpreter [/bin/bash]:')
+
+ # get the contents of the script
+ if self.user_confirm('Read an existing file [y/N]:', nospacer = True):
+ options.file = prompt_user('File:')
+ else:
+ (options.contents, ignore) = editor(delete=True)
+
+ # check user input
+ if options.interpreter == '': options.interpreter = '/bin/bash'
- if re.match('n', chroot, re.I):
- chroot = False
+ if re.match('n', options.chroot, re.I):
+ options.chroot = False
+ else:
+ options.chroot = True
+
+ if re.match('pre', options.execution_time, re.I):
+ options.execution_time = 'pre'
+ else:
+ options.execution_time = 'post'
else:
- chroot = True
+ if not options.profile:
+ logging.error('The Kickstart name is required')
+ return
+
+ if not options.file:
+ logging.error('A filename is required')
+ return
+
+ if not options.execution_time:
+ logging.error('The execution time is required')
+ return
+
+ if not options.chroot:
+ options.chroot = True
+
+ if not options.interpreter:
+ options.interpreter = '/bin/bash'
+
+ if options.file:
+ options.contents = read_file(options.file)
print
- print 'Type: %s' % script_type
- print 'Chroot: %s' % chroot
- print 'Interpreter: %s' % interpreter
+ print 'Profile Name: %s' % options.profile
+ print 'Execution Time: %s' % options.execution_time
+ print 'Chroot: %s' % options.chroot
+ print 'Interpreter: %s' % options.interpreter
print 'Contents:'
- print contents
+ print options.contents
if not self.user_confirm(): return
self.client.kickstart.profile.addScript(self.session,
- profile,
- contents,
- interpreter,
- script_type,
- chroot)
+ options.profile,
+ options.contents,
+ options.interpreter,
+ options.execution_time,
+ options.chroot)
####################
@@ -1639,7 +1717,7 @@ def do_kickstart_removescript(self, args):
while script_id == 0:
print
userinput = prompt_user('Script ID:', noblank = True)
-
+
try:
script_id = int(userinput)
except ValueError:
commit a6a6e2911c8816339017175b604e84731eee95c5
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Sep 23 16:27:59 2010 -0400
spacecmd: allow distribution_* functions to be called non-interactively
diff --git a/spacecmd/src/lib/distribution.py b/spacecmd/src/lib/distribution.py
index fcaa429..e7e7a5d 100644
--- a/spacecmd/src/lib/distribution.py
+++ b/spacecmd/src/lib/distribution.py
@@ -20,55 +20,102 @@
# NOTE: the 'self' variable is an instance of SpacewalkShell
+from optparse import Option
from spacecmd.utils import *
def help_distribution_create(self):
print 'distribution_create: Create a Kickstart tree'
- print 'usage: distribution_create'
-
-def do_distribution_create(self, args):
- name = prompt_user('Label:')
-
- base_path = prompt_user('Path to Kickstart Tree:')
-
- base_channel = ''
- while base_channel == '':
- print
- print 'Base Channels'
- print '-------------'
- print '\n'.join(sorted(self.list_base_channels()))
- print
-
- base_channel = prompt_user('Base Channel:')
-
- if base_channel not in self.list_base_channels():
+ print '''usage: distribution_create [options]
+
+options:
+ -n NAME
+ -d path to tree
+ -b base channel to associate with
+ -t install type [fedora|rhel_4/5/6|generic_rpm]'''
+
+def do_distribution_create(self, args, update = False):
+ options = [ Option('-n', '--name', action='store'),
+ Option('-p', '--path', action='store'),
+ Option('-b', '--base-channel', action='store'),
+ Option('-t', '--install-type', action='store') ]
+
+ (args, options) = parse_arguments(args, options)
+
+ # fill in the name of the distribution when updating
+ if update:
+ if len(args):
+ options.name = args[0]
+ elif not options.name:
+ logging.error('The name of the distribution is required')
+ return
+
+ if is_interactive(options):
+ if not update:
+ options.name = prompt_user('Name:', noblank = True)
+
+ options.path = prompt_user('Path to Kickstart Tree:', noblank = True)
+
+ options.base_channel = ''
+ while options.base_channel == '':
+ print
+ print 'Base Channels'
+ print '-------------'
+ print '\n'.join(sorted(self.list_base_channels()))
+ print
+
+ options.base_channel = prompt_user('Base Channel:')
+
+ if options.base_channel not in self.list_base_channels():
logging.warning('Invalid channel label')
- base_channel = ''
+ options.base_channel = ''
- install_types = \
- self.client.kickstart.tree.listInstallTypes(self.session)
+ install_types = \
+ self.client.kickstart.tree.listInstallTypes(self.session)
- install_types = [ t.get('label') for t in install_types ]
+ install_types = [ t.get('label') for t in install_types ]
- install_type = ''
- while install_type == '':
- print
- print 'Install Types'
- print '-------------'
- print '\n'.join(sorted(install_types))
- print
-
- install_type = prompt_user('Install Type:')
-
- if install_type not in install_types:
- logging.warning('Invalid install type')
- install_type = ''
-
- self.client.kickstart.tree.create(self.session,
- name,
- base_path,
- base_channel,
- install_type)
+ options.install_type = ''
+ while options.install_type == '':
+ print
+ print 'Install Types'
+ print '-------------'
+ print '\n'.join(sorted(install_types))
+ print
+
+ options.install_type = prompt_user('Install Type:')
+
+ if options.install_type not in install_types:
+ logging.warning('Invalid install type')
+ options.install_type = ''
+ else:
+ if not options.name:
+ logging.error('A name is required')
+ return
+
+ if not options.path:
+ logging.error('A path is required')
+ return
+
+ if not options.base_channel:
+ logging.error('A base channel is required')
+ return
+
+ if not options.install_type:
+ logging.error('An install type is required')
+ return
+
+ if update:
+ self.client.kickstart.tree.update(self.session,
+ options.name,
+ options.path,
+ options.base_channel,
+ options.install_type)
+ else:
+ self.client.kickstart.tree.create(self.session,
+ options.name,
+ options.path,
+ options.base_channel,
+ options.install_type)
####################
@@ -173,7 +220,12 @@ def do_distribution_rename(self, args):
def help_distribution_update(self):
print 'distribution_update: Update the path of a Kickstart tree'
- print 'usage: distribution_update LABEL'
+ print '''usage: distribution_update NAME [options]
+
+options:
+ -d path to tree
+ -b base channel to associate with
+ -t install type [fedora|rhel_4/5/6|generic_rpm]'''
def complete_distribution_update(self, text, line, beg, end):
if len(line.split(' ')) <= 2:
@@ -181,53 +233,6 @@ def complete_distribution_update(self, text, line, beg, end):
text)
def do_distribution_update(self, args):
- (args, options) = parse_arguments(args)
-
- if len(args) != 1:
- self.help_distribution_update()
- return
-
- label = args[0]
-
- base_path = prompt_user('Path to Kickstart Tree:')
-
- base_channel = ''
- while base_channel == '':
- print
- print 'Base Channels'
- print '-------------'
- print '\n'.join(sorted(self.list_base_channels()))
- print
-
- base_channel = prompt_user('Base Channel:')
-
- if base_channel not in self.list_base_channels():
- logging.warning('Invalid channel label')
- base_channel = ''
-
- install_types = \
- self.client.kickstart.tree.listInstallTypes(self.session)
-
- install_types = [ t.get('label') for t in install_types ]
-
- install_type = ''
- while install_type == '':
- print
- print 'Install Types'
- print '-------------'
- print '\n'.join(sorted(install_types))
- print
-
- install_type = prompt_user('Install Type:')
-
- if install_type not in install_types:
- logging.warning('Invalid install type')
- install_type = ''
-
- self.client.kickstart.tree.update(self.session,
- label,
- base_path,
- base_channel,
- install_type)
+ return self.do_distribution_create(args, update = True)
# vim:ts=4:expandtab:
commit 1bde86149e88467ac57b2dc3f548aea38773e185
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Sep 23 15:47:24 2010 -0400
spacecmd: allow cryptokey_* functions to be called non-interactively
diff --git a/spacecmd/src/lib/cryptokey.py b/spacecmd/src/lib/cryptokey.py
index 832eeb6..e067e70 100644
--- a/spacecmd/src/lib/cryptokey.py
+++ b/spacecmd/src/lib/cryptokey.py
@@ -20,35 +20,66 @@
# NOTE: the 'self' variable is an instance of SpacewalkShell
+from optparse import Option
from spacecmd.utils import *
def help_cryptokey_create(self):
print 'cryptokey_create: Create a cryptographic key'
- print 'usage: cryptokey_create'
+ print '''usage: cryptokey_create [options]
+
+options:
+ -t GPG or SSL
+ -d DESCRIPTION
+ -f KEY_FILE'''
def do_cryptokey_create(self, args):
- key_type = ''
- while not re.match('GPG|SSL', key_type):
- key_type = prompt_user('GPG or SSL [G/S]:')
+ options = [ Option('-t', '--type', action='store'),
+ Option('-d', '--description', action='store'),
+ Option('-f', '--file', action='store') ]
+
+ (args, options) = parse_arguments(args, options)
+
+ if is_interactive(options):
+ options.type = prompt_user('GPG or SSL [G/S]:')
+
+ options.description = ''
+ while options.description == '':
+ options.description = prompt_user('Description:')
- if re.match('G', key_type, re.I):
- key_type = 'GPG'
- elif re.match('S', key_type, re.I):
- key_type = 'SSL'
+ if self.user_confirm('Read an existing file [y/N]:', nospacer = True):
+ options.file = prompt_user('File:')
else:
- logging.warning('Invalid key type')
- key_type = ''
+ options.contents = editor(delete=True)
+ else:
+ if not options.type:
+ logging.error('The key type is required')
+ return
- description = ''
- while description == '':
- description = prompt_user('Description:')
+ if not options.description:
+ logging.error('A description is required')
+ return
+
+ if not options.file:
+ logging.error('A file containing the key is required')
+ return
- content = editor(delete=True)
+ # read the file the user specified
+ if options.file:
+ options.contents = read_file(options.file)
+
+ # translate the key type to what the server expects
+ if re.match('G', options.type, re.I):
+ options.type = 'GPG'
+ elif re.match('S', options.type, re.I):
+ options.type = 'SSL'
+ else:
+ logging.error('Invalid key type')
+ return
self.client.kickstart.keys.create(self.session,
- description,
- key_type,
- content)
+ options.description,
+ options.type,
+ options.contents)
####################
commit 2e2cd662b93cbb0980f1b56293591afe815b6b13
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Sep 23 15:46:42 2010 -0400
spacecmd: added a function to read files
diff --git a/spacecmd/src/lib/utils.py b/spacecmd/src/lib/utils.py
index 179441d..baa9508 100644
--- a/spacecmd/src/lib/utils.py
+++ b/spacecmd/src/lib/utils.py
@@ -450,4 +450,13 @@ def max_length(items):
return max_size
+
+# read in a file
+def read_file(filename):
+ handle = open(filename, 'r')
+ contents = handle.read()
+ handle.close()
+
+ return contents
+
# vim:ts=4:expandtab:
commit 59c40a40fd381a5f2de28355d922dc679a1a847d
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Sep 23 15:21:36 2010 -0400
spacecmd: allow activationkey_* functions to be called non-interactively
diff --git a/spacecmd/src/lib/activationkey.py b/spacecmd/src/lib/activationkey.py
index 388f718..6cad8b7 100644
--- a/spacecmd/src/lib/activationkey.py
+++ b/spacecmd/src/lib/activationkey.py
@@ -21,6 +21,7 @@
# NOTE: the 'self' variable is an instance of SpacewalkShell
import re, shlex
+from optparse import Option
from spacecmd.utils import *
def help_activationkey_addpackages(self):
@@ -447,7 +448,11 @@ def do_activationkey_listconfigchannels(self, args):
def help_activationkey_addconfigchannels(self):
print 'activationkey_addconfigchannels: Add config channels ' \
'to an activation key'
- print 'usage: activationkey_addconfigchannels KEY <CHANNEL ...>'
+ print '''usage: activationkey_addconfigchannels KEY <CHANNEL ...>
[options]
+
+options:
+ -t add channels to the top of the list
+ -b add channels to the bottom of the list'''
def complete_activationkey_addconfigchannels(self, text, line, beg, end):
parts = line.split(' ')
@@ -458,7 +463,10 @@ def complete_activationkey_addconfigchannels(self, text, line, beg,
end):
return tab_completer(self.do_configchannel_list('', True), text)
def do_activationkey_addconfigchannels(self, args):
- (args, options) = parse_arguments(args)
+ options = [ Option('-t', '--top', action='store_true'),
+ Option('-b', '--bottom', action='store_true') ]
+
+ (args, options) = parse_arguments(args, options)
if len(args) < 2:
self.help_activationkey_addconfigchannels()
@@ -467,16 +475,22 @@ def do_activationkey_addconfigchannels(self, args):
key = [ args.pop(0) ]
channels = args
- answer = prompt_user('Add to top or bottom? [T/b]:')
- if re.match('b', answer, re.I):
- location = False
+ if is_interactive(options):
+ answer = prompt_user('Add to top or bottom? [T/b]:')
+ if re.match('b', answer, re.I):
+ options.top = False
+ else:
+ options.top = True
else:
- location = True
+ if options.bottom:
+ options.top = False
+ else:
+ options.top = True
self.client.activationkey.addConfigChannels(self.session,
key,
channels,
- location)
+ options.top)
####################
@@ -557,35 +571,65 @@ def do_activationkey_setconfigchannelorder(self, args):
def help_activationkey_create(self):
print 'activationkey_create: Create an activation key'
- print 'usage: activationkey_create'
+ print '''usage: activationkey_create [options]
+
+options:
+ -n NAME
+ -d DESCRIPTION
+ -b BASE_CHANNEL
+ -u set key as universal default
+ -e [provisioning_entitled,enterprise_entitled,monitoring_entitled,
+ virtualization_host,virtualization_host_platform]'''
def do_activationkey_create(self, args):
- name = prompt_user('Name (blank to autogenerate):')
- description = prompt_user('Description [None]:')
+ options = [ Option('-n', '--name', action='store'),
+ Option('-d', '--description', action='store'),
+ Option('-b', '--base-channel', action='store'),
+ Option('-e', '--entitlements', action='store'),
+ Option('-u', '--universal', action='store_true')
]
- print
- print 'Base Channels'
- print '-------------'
- print '\n'.join(sorted(self.list_base_channels()))
- print
+ (args, options) = parse_arguments(args, options)
- base_channel = prompt_user('Base Channel (blank for default):')
+ if is_interactive(options):
+ options.name = prompt_user('Name (blank to autogenerate):')
+ options.description = prompt_user('Description [None]:')
- entitlements = []
- for e in self.ENTITLEMENTS:
- if e == 'enterprise_entitled': continue
+ print
+ print 'Base Channels'
+ print '-------------'
+ print '\n'.join(sorted(self.list_base_channels()))
+ print
+
+ options.base_channel = prompt_user('Base Channel (blank for default):')
- if self.user_confirm('%s Entitlement [y/N]:' % e):
- entitlements.append(e)
+ options.entitlements = []
- default = self.user_confirm('Universal Default [y/N]:')
+ for e in self.ENTITLEMENTS:
+ if e == 'enterprise_entitled': continue
+
+ if self.user_confirm('%s Entitlement [y/N]:' % e):
+ options.entitlements.append(e)
+
+ options.universal = self.user_confirm('Universal Default [y/N]:')
+ else:
+ if not options.name: options.name = ''
+ if not options.description: options.description = ''
+ if not options.base_channel: options.base_channel = ''
+ if not options.universal: options.universal = False
+ if options.entitlements:
+ options.entitlements = options.entitlements.split(',')
+
+ # remove empty strings from the list
+ options.entitlements.remove('')
+ else:
+ options.entitlements = []
new_key = self.client.activationkey.create(self.session,
- name,
- description,
- base_channel,
- entitlements,
- default)
+ options.name,
+ options.description,
+ options.base_channel,
+ options.entitlements,
+ options.universal)
logging.info('Created activation key %s' % new_key)
commit 84b769944dac88ef4ae4d9ed80d2704c3888a543
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Sep 23 15:20:21 2010 -0400
spacecmd: added function to test if the called function is interactive
diff --git a/spacecmd/src/lib/utils.py b/spacecmd/src/lib/utils.py
index df38b20..179441d 100644
--- a/spacecmd/src/lib/utils.py
+++ b/spacecmd/src/lib/utils.py
@@ -43,6 +43,19 @@ def parse_arguments(args, options = []):
return []
+# check if any named options were passed to the function, and if so,
+# declare that the function is non-interactive
+# note: because we do it this way, default options are not passed into
+# OptionParser, as it would make determining if any options were passed
+# too complex
+def is_interactive(options):
+ for key in options.__dict__:
+ if options.__dict__[key]:
+ return False
+
+ return True
+
+
def load_cache(cachefile):
data = {}
expire = datetime.now()
commit e0db7f2cf40d1fe18f9f1038bbb6a7d48ace9716
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Sep 23 13:24:33 2010 -0400
spacecmd: support for named arguments in utils.parse_arguments()
diff --git a/spacecmd/src/lib/activationkey.py b/spacecmd/src/lib/activationkey.py
index 353ec5e..388f718 100644
--- a/spacecmd/src/lib/activationkey.py
+++ b/spacecmd/src/lib/activationkey.py
@@ -37,7 +37,7 @@ def complete_activationkey_addpackages(self, text, line, beg, end):
return tab_completer(self.get_package_names(), text)
def do_activationkey_addpackages(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args) >= 2:
self.help_activationkey_addpackages()
@@ -68,7 +68,7 @@ def complete_activationkey_removepackages(self, text, line, beg, end):
return tab_completer(packages, text)
def do_activationkey_removepackages(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args) >= 2:
self.help_activationkey_removepackages()
@@ -95,7 +95,7 @@ def complete_activationkey_addgroups(self, text, line, beg, end):
return tab_completer(self.do_group_list('', True), parts[-1])
def do_activationkey_addgroups(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args) >= 2:
self.help_activationkey_addgroups()
@@ -135,7 +135,7 @@ def complete_activationkey_removegroups(self, text, line, beg, end):
return tab_completer(groups, text)
def do_activationkey_removegroups(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args) >= 2:
self.help_activationkey_removegroups()
@@ -167,7 +167,7 @@ def complete_activationkey_addentitlements(self, text, line, beg,
end):
return tab_completer(self.ENTITLEMENTS, text)
def do_activationkey_addentitlements(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args) >= 2:
self.help_activationkey_addentitlements()
@@ -200,7 +200,7 @@ def complete_activationkey_removeentitlements(self, text, line, beg,
end):
return tab_completer(entitlements, text)
def do_activationkey_removeentitlements(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args) >= 2:
self.help_activationkey_removeentitlements()
@@ -247,7 +247,7 @@ def complete_activationkey_addchildchannels(self, text, line, beg,
end):
return tab_completer(child_channels, text)
def do_activationkey_addchildchannels(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args) >= 2:
self.help_activationkey_addchildchannels()
@@ -277,7 +277,7 @@ def complete_activationkey_removechildchannels(self, text, line, beg,
end):
return tab_completer(key_details.get('child_channel_labels'), text)
def do_activationkey_removechildchannels(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args) >= 2:
self.help_activationkey_removechildchannels()
@@ -301,7 +301,7 @@ def complete_activationkey_listchildchannels(self, text, line, beg,
end):
return tab_completer(self.do_activationkey_list('', True), text)
def do_activationkey_listchildchannels(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_activationkey_listchildchannels()
@@ -325,7 +325,7 @@ def complete_activationkey_listbasechannel(self, text, line, beg,
end):
return tab_completer(self.do_activationkey_list('', True), text)
def do_activationkey_listbasechannel(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_activationkey_listbasechannel()
@@ -348,7 +348,7 @@ def complete_activationkey_listgroups(self, text, line, beg, end):
return tab_completer(self.do_activationkey_list('', True), text)
def do_activationkey_listgroups(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_activationkey_listgroups()
@@ -374,7 +374,7 @@ def complete_activationkey_listentitlements(self, text, line, beg,
end):
return tab_completer(self.do_activationkey_list('', True), text)
def do_activationkey_listentitlements(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_activationkey_listentitlements()
@@ -398,7 +398,7 @@ def complete_activationkey_listpackages(self, text, line, beg, end):
return tab_completer(self.do_activationkey_list('', True), text)
def do_activationkey_listpackages(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_activationkey_listpackages()
@@ -425,7 +425,7 @@ def complete_activationkey_listconfigchannels(self, text, line, beg,
end):
return tab_completer(self.do_activationkey_list('', True), text)
def do_activationkey_listconfigchannels(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_activationkey_listconfigchannels()
@@ -458,7 +458,7 @@ def complete_activationkey_addconfigchannels(self, text, line, beg,
end):
return tab_completer(self.do_configchannel_list('', True), text)
def do_activationkey_addconfigchannels(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_activationkey_addconfigchannels()
@@ -499,7 +499,7 @@ def complete_activationkey_removeconfigchannels(self, text, line, beg,
end):
return tab_completer(config_channels, text)
def do_activationkey_removeconfigchannels(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args) >= 2:
self.help_activationkey_removeconfigchannels()
@@ -524,7 +524,7 @@ def complete_activationkey_setconfigchannelorder(self, text, line,
beg,
return tab_completer(self.do_activationkey_list('', True), text)
def do_activationkey_setconfigchannelorder(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 1:
self.help_activationkey_setconfigchannelorder()
@@ -599,7 +599,7 @@ def complete_activationkey_delete(self, text, line, beg, end):
return tab_completer(self.do_activationkey_list('', True), text)
def do_activationkey_delete(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_activationkey_delete()
@@ -642,7 +642,7 @@ def complete_activationkey_listsystems(self, text, line, beg, end):
return tab_completer(self.do_activationkey_list('', True), text)
def do_activationkey_listsystems(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_activationkey_listsystems()
@@ -673,7 +673,7 @@ def complete_activationkey_details(self, text, line, beg, end):
return tab_completer(self.do_activationkey_list('', True), text)
def do_activationkey_details(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_activationkey_details()
@@ -770,7 +770,7 @@ def complete_activationkey_enableconfigdeployment(self, text, line,
beg,
return tab_completer(self.do_activationkey_list('', True), text)
def do_activationkey_enableconfigdeployment(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_activationkey_enableconfigdeployment()
@@ -792,7 +792,7 @@ def complete_activationkey_disableconfigdeployment(self, text, line,
beg,
return tab_completer(self.do_activationkey_list('', True), text)
def do_activationkey_disableconfigdeployment(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_activationkey_disableconfigdeployment()
@@ -818,7 +818,7 @@ def complete_activationkey_setbasechannel(self, text, line, beg,
end):
return tab_completer(list_base_channels(self), text)
def do_activationkey_setbasechannel(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args) >= 2:
self.help_activationkey_setbasechannel()
@@ -849,7 +849,7 @@ def complete_activationkey_setuniversaldefault(self, text, line, beg,
end):
return tab_completer(self.do_activationkey_list('', True), text)
def do_activationkey_setuniversaldefault(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_activationkey_setuniversaldefault()
diff --git a/spacecmd/src/lib/configchannel.py b/spacecmd/src/lib/configchannel.py
index 5cf224d..1f3a996 100644
--- a/spacecmd/src/lib/configchannel.py
+++ b/spacecmd/src/lib/configchannel.py
@@ -51,7 +51,7 @@ def do_configchannel_listsystems(self, args):
logging.warning("This version of the API doesn't support this
method")
return
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_configchannel_listsystems()
@@ -77,7 +77,7 @@ def complete_configchannel_listfiles(self, text, line, beg, end):
return tab_completer(self.do_configchannel_list('', True), text)
def do_configchannel_listfiles(self, args, doreturn=False):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_configchannel_listfiles()
@@ -114,7 +114,7 @@ def complete_configchannel_filedetails(self, text, line, beg, end):
return []
def do_configchannel_filedetails(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_configchannel_filedetails()
@@ -185,7 +185,7 @@ def complete_configchannel_details(self, text, line, beg, end):
return tab_completer(self.do_configchannel_list('', True), text)
def do_configchannel_details(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_configchannel_details()
@@ -220,7 +220,7 @@ def help_configchannel_create(self):
print 'usage: configchannel_create [NAME] [DESCRIPTION]'
def do_configchannel_create(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) > 0:
name = args[0]
@@ -253,7 +253,7 @@ def complete_configchannel_delete(self, text, line, beg, end):
return tab_completer(self.do_configchannel_list('', True), text)
def do_configchannel_delete(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_configchannel_delete()
@@ -274,7 +274,7 @@ def complete_configchannel_addfile(self, text, line, beg, end):
return tab_completer(self.do_configchannel_list('', True), text)
def do_configchannel_addfile(self, args, path=''):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 1:
self.help_configchannel_addfile()
@@ -428,7 +428,7 @@ def complete_configchannel_updatefile(self, text, line, beg, end):
text)
def do_configchannel_updatefile(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 2:
self.help_configchannel_updatefile()
@@ -455,7 +455,7 @@ def complete_configchannel_removefiles(self, text, line, beg, end):
text)
def do_configchannel_removefiles(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_configchannel_removefiles()
diff --git a/spacecmd/src/lib/cryptokey.py b/spacecmd/src/lib/cryptokey.py
index 5595593..832eeb6 100644
--- a/spacecmd/src/lib/cryptokey.py
+++ b/spacecmd/src/lib/cryptokey.py
@@ -62,7 +62,7 @@ def complete_cryptokey_delete(self, text, line, beg, end):
text)
def do_cryptokey_delete(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 1:
self.help_cryptokey_delete()
@@ -99,7 +99,7 @@ def complete_cryptokey_details(self, text, line, beg, end):
return tab_completer(self.do_cryptokey_list('', True), text)
def do_cryptokey_details(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_cryptokey_details()
diff --git a/spacecmd/src/lib/custominfo.py b/spacecmd/src/lib/custominfo.py
index 1002a3e..083aa48 100644
--- a/spacecmd/src/lib/custominfo.py
+++ b/spacecmd/src/lib/custominfo.py
@@ -27,7 +27,7 @@ def help_custominfo_createkey(self):
print 'usage: custominfo_createkey [NAME] [DESCRIPTION]'
def do_custominfo_createkey(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) > 0:
key = args[0]
@@ -58,7 +58,7 @@ def complete_custominfo_deletekey(self, text, line, beg, end):
return tab_completer(self.do_custominfo_listkeys('', True), text)
def do_custominfo_deletekey(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_custominfo_deletekey()
@@ -95,7 +95,7 @@ def complete_custominfo_details(self, text, line, beg, end):
return tab_completer(self.do_custominfo_listkeys('', True), text)
def do_custominfo_details(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_custominfo_details()
diff --git a/spacecmd/src/lib/distribution.py b/spacecmd/src/lib/distribution.py
index 21fd418..fcaa429 100644
--- a/spacecmd/src/lib/distribution.py
+++ b/spacecmd/src/lib/distribution.py
@@ -107,7 +107,7 @@ def complete_distribution_delete(self, text, line, beg, end):
text)
def do_distribution_delete(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 1:
self.help_distribution_delete()
@@ -128,7 +128,7 @@ def complete_distribution_details(self, text, line, beg, end):
return tab_completer(self.do_distribution_list('', True), text)
def do_distribution_details(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 1:
self.help_distribution_details()
@@ -158,7 +158,7 @@ def complete_distribution_rename(self, text, line, beg, end):
text)
def do_distribution_rename(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 2:
self.help_distribution_rename()
@@ -181,7 +181,7 @@ def complete_distribution_update(self, text, line, beg, end):
text)
def do_distribution_update(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 1:
self.help_distribution_update()
diff --git a/spacecmd/src/lib/errata.py b/spacecmd/src/lib/errata.py
index 52569fe..76ff30b 100644
--- a/spacecmd/src/lib/errata.py
+++ b/spacecmd/src/lib/errata.py
@@ -46,7 +46,7 @@ def complete_errata_apply(self, text, line, beg, end):
return self.tab_complete_errata(text)
def do_errata_apply(self, args, only_systems=[]):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_errata_apply()
@@ -168,7 +168,7 @@ def complete_errata_listaffectedsystems(self, text, line, beg, end):
return self.tab_complete_errata(text)
def do_errata_listaffectedsystems(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_errata_listaffectedsystems()
@@ -199,7 +199,7 @@ def complete_errata_listcves(self, text, line, beg, end):
return self.tab_complete_errata(text)
def do_errata_listcves(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_errata_listcves()
@@ -232,7 +232,7 @@ def complete_errata_details(self, text, line, beg, end):
return self.tab_complete_errata(text)
def do_errata_details(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_errata_details()
@@ -317,7 +317,7 @@ def complete_errata_delete(self, text, line, beg, end):
return self.tab_complete_errata(text)
def do_errata_delete(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_errata_delete()
@@ -362,7 +362,7 @@ def complete_errata_publish(self, text, line, beg, end):
return tab_completer(self.do_softwarechannel_list('', True), text)
def do_errata_publish(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_errata_publish()
@@ -398,7 +398,7 @@ def complete_errata_search(self, text, line, beg, end):
return tab_completer(self.do_errata_list('', True), text)
def do_errata_search(self, args, doreturn=False):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_errata_search()
diff --git a/spacecmd/src/lib/filepreservation.py b/spacecmd/src/lib/filepreservation.py
index 9e51e40..4e5c9cf 100644
--- a/spacecmd/src/lib/filepreservation.py
+++ b/spacecmd/src/lib/filepreservation.py
@@ -45,7 +45,7 @@ def help_filepreservation_create(self):
print 'usage: filepreservation_create [NAME] [FILE ...]'
def do_filepreservation_create(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args):
name = args[0]
@@ -92,7 +92,7 @@ def complete_filepreservation_delete(self, text, line, beg, end):
return tab_completer(self.do_filepreservation_list('', True), text)
def do_filepreservation_delete(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_filepreservation_delete()
@@ -115,7 +115,7 @@ def complete_filepreservation_details(self, text, line, beg, end):
return tab_completer(self.do_filepreservation_list('', True), text)
def do_filepreservation_details(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_filepreservation_details()
diff --git a/spacecmd/src/lib/group.py b/spacecmd/src/lib/group.py
index 240fc2b..efd37f7 100644
--- a/spacecmd/src/lib/group.py
+++ b/spacecmd/src/lib/group.py
@@ -39,7 +39,7 @@ def complete_group_addsystems(self, text, line, beg, end):
return self.tab_complete_systems(parts[-1])
def do_group_addsystems(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_group_addsystems()
@@ -82,7 +82,7 @@ def complete_group_removesystems(self, text, line, beg, end):
return self.tab_complete_systems(parts[-1])
def do_group_removesystems(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_group_removesystems()
@@ -120,7 +120,7 @@ def help_group_create(self):
print 'usage: group_create [NAME] [DESCRIPTION]'
def do_group_create(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) > 0:
name = args[0]
@@ -144,7 +144,7 @@ def complete_group_delete(self, text, line, beg, end):
return tab_completer(self.do_group_list('', True), text)
def do_group_delete(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_group_delete()
@@ -184,7 +184,7 @@ def complete_group_listsystems(self, text, line, beg, end):
return tab_completer(self.do_group_list('', True), text)
def do_group_listsystems(self, args, doreturn=False):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_group_listsystems()
@@ -215,7 +215,7 @@ def complete_group_details(self, text, line, beg, end):
return tab_completer(self.do_group_list('', True), text)
def do_group_details(self, args, short=False):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_group_details()
diff --git a/spacecmd/src/lib/kickstart.py b/spacecmd/src/lib/kickstart.py
index d0d08d8..4ad6983 100644
--- a/spacecmd/src/lib/kickstart.py
+++ b/spacecmd/src/lib/kickstart.py
@@ -59,7 +59,7 @@ def help_kickstart_create(self):
print 'usage: kickstart_create [PROFILE]'
def do_kickstart_create(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args):
name = args[0]
@@ -120,7 +120,7 @@ def complete_kickstart_delete(self, text, line, beg, end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_delete(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 1:
self.help_kickstart_delete()
@@ -138,7 +138,7 @@ def help_kickstart_import(self):
print 'usage: kickstart_import PROFILE FILE'
def do_kickstart_import(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_import()
@@ -201,7 +201,7 @@ def complete_kickstart_details(self, text, line, beg, end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_details(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 1:
self.help_kickstart_details()
@@ -379,7 +379,7 @@ def complete_kickstart_getcontents(self, text, line, beg, end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_getcontents(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_getcontents()
@@ -416,7 +416,7 @@ def complete_kickstart_rename(self, text, line, beg, end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_rename(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 2:
self.help_kickstart_rename()
@@ -441,7 +441,7 @@ def complete_kickstart_listcryptokeys(self, text, line, beg, end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_listcryptokeys(self, args, doreturn=False):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_listcryptokeys()
@@ -474,7 +474,7 @@ def complete_kickstart_addcryptokeys(self, text, line, beg, end):
return tab_completer(self.do_cryptokey_list('', True), text)
def do_kickstart_addcryptokeys(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_kickstart_addcryptokeys()
@@ -509,7 +509,7 @@ def complete_kickstart_removecryptokeys(self, text, line, beg, end):
return tab_completer(keys, text)
def do_kickstart_removecryptokeys(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_kickstart_removecryptokeys()
@@ -536,7 +536,7 @@ def complete_kickstart_listactivationkeys(self, text, line, beg,
end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_listactivationkeys(self, args, doreturn=False):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_listactivationkeys()
@@ -573,7 +573,7 @@ def complete_kickstart_addactivationkeys(self, text, line, beg, end):
text)
def do_kickstart_addactivationkeys(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_kickstart_addactivationkeys()
@@ -610,7 +610,7 @@ def complete_kickstart_removeactivationkeys(self, text, line, beg,
return tab_completer(keys, text)
def do_kickstart_removeactivationkeys(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_kickstart_removeactivationkeys()
@@ -641,7 +641,7 @@ def complete_kickstart_enableconfigmanagement(self, text, line, beg,
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_enableconfigmanagement(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_enableconfigmanagement()
@@ -667,7 +667,7 @@ def complete_kickstart_disableconfigmanagement(self, text, line, beg,
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_disableconfigmanagement(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_disableconfigmanagement()
@@ -693,7 +693,7 @@ def complete_kickstart_enableremotecommands(self, text, line, beg,
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_enableremotecommands(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_enableremotecommands()
@@ -718,7 +718,7 @@ def complete_kickstart_disableremotecommands(self, text, line, beg,
end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_disableremotecommands(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_disableremotecommands()
@@ -744,7 +744,7 @@ def complete_kickstart_setlocale(self, text, line, beg, end):
return tab_completer(list_locales(), text)
def do_kickstart_setlocale(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 2:
self.help_kickstart_setlocale()
@@ -778,7 +778,7 @@ def complete_kickstart_setselinux(self, text, line, beg, end):
return tab_completer(modes, text)
def do_kickstart_setselinux(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 2:
self.help_kickstart_setselinux()
@@ -805,7 +805,7 @@ def complete_kickstart_setpartitions(self, text, line, beg, end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_setpartitions(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_setpartitions()
@@ -850,7 +850,7 @@ def complete_kickstart_setdistribution(self, text, line, beg, end):
return tab_completer(self.do_distribution_list('', True), text)
def do_kickstart_setdistribution(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 2:
self.help_kickstart_setdistribution()
@@ -876,7 +876,7 @@ def complete_kickstart_enablelogging(self, text, line, beg, end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_enablelogging(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_enablelogging()
@@ -902,7 +902,7 @@ def complete_kickstart_addvariable(self, text, line, beg, end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_addvariable(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 3:
self.help_kickstart_addvariable()
@@ -945,7 +945,7 @@ def complete_kickstart_updatevariable(self, text, line, beg, end):
return tab_completer(variables.keys(), text)
def do_kickstart_updatevariable(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 3:
self.help_kickstart_updatevariable()
@@ -977,7 +977,7 @@ def complete_kickstart_removevariables(self, text, line, beg, end):
return tab_completer(variables.keys(), text)
def do_kickstart_removevariables(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_kickstart_removevariables()
@@ -1011,7 +1011,7 @@ def complete_kickstart_listvariables(self, text, line, beg, end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_listvariables(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_listvariables()
@@ -1040,7 +1040,7 @@ def complete_kickstart_addoption(self, text, line, beg, end):
return tab_completer(sorted(self.KICKSTART_OPTIONS), text)
def do_kickstart_addoption(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_kickstart_addoption()
@@ -1098,7 +1098,7 @@ def complete_kickstart_removeoptions(self, text, line, beg, end):
return tab_completer(sorted(options), text)
def do_kickstart_removeoptions(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_kickstart_removeoptions()
@@ -1135,7 +1135,7 @@ def complete_kickstart_listoptions(self, text, line, beg, end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_listoptions(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_listoptions()
@@ -1164,7 +1164,7 @@ def complete_kickstart_listcustomoptions(self, text, line, beg,
end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_listcustomoptions(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_listcustomoptions()
@@ -1193,7 +1193,7 @@ def complete_kickstart_setcustomoptions(self, text, line, beg,
end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_setcustomoptions(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_setcustomoptions()
@@ -1257,7 +1257,7 @@ def complete_kickstart_addchildchannels(self, text, line, beg,
end):
parent=parent_channel), text)
def do_kickstart_addchildchannels(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_kickstart_addchildchannels()
@@ -1293,7 +1293,7 @@ def complete_kickstart_removechildchannels(self, text, line, beg,
parts[1], True), text)
def do_kickstart_removechildchannels(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_kickstart_removechildchannels()
@@ -1327,7 +1327,7 @@ def complete_kickstart_listchildchannels(self, text, line, beg,
end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_listchildchannels(self, args, doreturn=False):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_listchildchannels()
@@ -1361,7 +1361,7 @@ def complete_kickstart_addfilepreservations(self, text, line, beg,
end):
text)
def do_kickstart_addfilepreservations(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_addfilepreservations()
@@ -1402,7 +1402,7 @@ def complete_kickstart_removefilepreservations(self, text, line,
beg,
return tab_completer(files, text)
def do_kickstart_removefilepreservations(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_kickstart_removefilepreservations()
@@ -1425,7 +1425,7 @@ def complete_kickstart_listpackages(self, text, line, beg, end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_listpackages(self, args, doreturn = False):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_listpackages()
@@ -1458,7 +1458,7 @@ def complete_kickstart_addpackages(self, text, line, beg, end):
return tab_completer(self.get_package_names(), text)
def do_kickstart_addpackages(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args) >= 2:
self.help_kickstart_addpackages()
@@ -1488,7 +1488,7 @@ def complete_kickstart_removepackages(self, text, line, beg, end):
parts[1], True), text)
def do_kickstart_removepackages(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_kickstart_removepackages()
@@ -1519,7 +1519,7 @@ def complete_kickstart_listscripts(self, text, line, beg, end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_listscripts(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_listscripts()
@@ -1558,7 +1558,7 @@ def complete_kickstart_addscript(self, text, line, beg, end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_addscript(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_addscript()
@@ -1615,7 +1615,7 @@ def complete_kickstart_removescript(self, text, line, beg, end):
return tab_completer(self.do_kickstart_list('', True), text)
def do_kickstart_removescript(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_kickstart_removescript()
diff --git a/spacecmd/src/lib/misc.py b/spacecmd/src/lib/misc.py
index 24dc3a4..4f35603 100644
--- a/spacecmd/src/lib/misc.py
+++ b/spacecmd/src/lib/misc.py
@@ -162,7 +162,7 @@ def help_login(self):
print 'usage: login [USERNAME] [SERVER]'
def do_login(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
# logout before logging in again
if len(self.session):
diff --git a/spacecmd/src/lib/package.py b/spacecmd/src/lib/package.py
index 7916cb2..383d156 100644
--- a/spacecmd/src/lib/package.py
+++ b/spacecmd/src/lib/package.py
@@ -30,7 +30,7 @@ def complete_package_details(self, text, line, beg, end):
return tab_completer(self.get_package_names(True), text)
def do_package_details(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_package_details()
@@ -140,7 +140,7 @@ def complete_package_remove(self, text, line, beg, end):
return tab_completer(self.get_package_names(True), text)
def do_package_remove(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_package_remove()
@@ -224,7 +224,7 @@ def complete_package_listinstalledsystems(self, text, line, beg,
end):
return tab_completer(self.get_package_names(True), text)
def do_package_listinstalledsystems(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_package_listinstalledsystems()
@@ -265,7 +265,7 @@ def complete_package_listerrata(self, text, line, beg, end):
return tab_completer(self.get_package_names(True), text)
def do_package_listerrata(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_package_listerrata()
diff --git a/spacecmd/src/lib/report.py b/spacecmd/src/lib/report.py
index 4798e65..361eaa2 100644
--- a/spacecmd/src/lib/report.py
+++ b/spacecmd/src/lib/report.py
@@ -54,7 +54,7 @@ def help_report_inactivesystems(self):
print 'usage: report_inactivesystems [DAYS]'
def do_report_inactivesystems(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
# allow the user to set a limit on the number of days
if len(args) == 1:
@@ -129,7 +129,7 @@ def help_report_errata(self):
#XXX: performance is terrible due to all the API calls
def do_report_errata(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
errata_list = self.expand_errata(args)
@@ -165,7 +165,7 @@ def help_report_ipaddresses(self):
print self.HELP_SYSTEM_OPTS
def do_report_ipaddresses(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args):
# use the systems listed in the SSM
@@ -217,7 +217,7 @@ def help_report_kernels(self):
print self.HELP_SYSTEM_OPTS
def do_report_kernels(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args):
# use the systems listed in the SSM
diff --git a/spacecmd/src/lib/schedule.py b/spacecmd/src/lib/schedule.py
index 2aa72d4..163b4a2 100644
--- a/spacecmd/src/lib/schedule.py
+++ b/spacecmd/src/lib/schedule.py
@@ -27,7 +27,7 @@ from spacecmd.utils import *
# completed/failed/pending systems so we don't need to make
# additional API calls to get those numbers
def print_schedule_summary(self, type, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) > 0:
begin_date = parse_time_input(args[0])
@@ -120,7 +120,7 @@ def complete_schedule_cancel(self, text, line, beg, end):
return []
def do_schedule_cancel(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_schedule_cancel()
@@ -165,7 +165,7 @@ def complete_schedule_reschedule(self, text, line, beg, end):
return []
def do_schedule_reschedule(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_schedule_reschedule()
@@ -209,7 +209,7 @@ def help_schedule_details(self):
print 'usage: schedule_details ID'
def do_schedule_details(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_schedule_details()
@@ -281,7 +281,7 @@ def help_schedule_getoutput(self):
print 'usage: schedule_getoutput ID'
def do_schedule_getoutput(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_schedule_getoutput()
diff --git a/spacecmd/src/lib/shell.py b/spacecmd/src/lib/shell.py
index 3c4d057..73e655e 100644
--- a/spacecmd/src/lib/shell.py
+++ b/spacecmd/src/lib/shell.py
@@ -184,7 +184,6 @@ Type: 'help' for a list of commands
# append the arguments to the substituted command
if history_match:
line += ' %s' % args
- parse_arguments(line)
readline.add_history(line)
print line
diff --git a/spacecmd/src/lib/snippet.py b/spacecmd/src/lib/snippet.py
index 7f0be8d..c0101e2 100644
--- a/spacecmd/src/lib/snippet.py
+++ b/spacecmd/src/lib/snippet.py
@@ -47,7 +47,7 @@ def complete_snippet_details(self, text, line, beg, end):
text)
def do_snippet_details(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_snippet_details()
@@ -85,7 +85,7 @@ def help_snippet_create(self):
print 'usage: snippet_create'
def do_snippet_create(self, args, name=''):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
template = ''
if name:
@@ -119,7 +119,7 @@ def complete_snippet_update(self, text, line, beg, end):
return tab_completer(self.do_snippet_list('', True), text)
def do_snippet_update(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_snippet_update()
@@ -137,7 +137,7 @@ def complete_snippet_delete(self, text, line, beg, end):
return tab_completer(self.do_snippet_list('', True), text)
def do_snippet_delete(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_snippet_delete()
diff --git a/spacecmd/src/lib/softwarechannel.py b/spacecmd/src/lib/softwarechannel.py
index ccd83c5..526c084 100644
--- a/spacecmd/src/lib/softwarechannel.py
+++ b/spacecmd/src/lib/softwarechannel.py
@@ -35,7 +35,7 @@ def complete_softwarechannel_getentitlements(self, text, line, beg,
end):
return tab_completer(self.do_softwarechannel_list('', True), text)
def do_softwarechannel_getentitlements(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_softwarechannel_getentitlements()
@@ -100,7 +100,7 @@ def complete_softwarechannel_listsystems(self, text, line, beg, end):
return tab_completer(self.do_softwarechannel_list('', True), text)
def do_softwarechannel_listsystems(self, args, doreturn=False):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_softwarechannel_listsystems()
@@ -135,7 +135,7 @@ def complete_softwarechannel_listpackages(self, text, line, beg,
end):
return []
def do_softwarechannel_listpackages(self, args, doreturn=False):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_softwarechannel_listpackages()
@@ -168,7 +168,7 @@ def complete_softwarechannel_listallpackages(self, text, line, beg,
end):
return []
def do_softwarechannel_listallpackages(self, args, doreturn=False):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_softwarechannel_listallpackages()
@@ -197,7 +197,7 @@ def complete_softwarechannel_details(self, text, line, beg, end):
return tab_completer(self.do_softwarechannel_list('', True), text)
def do_softwarechannel_details(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_softwarechannel_details()
@@ -268,7 +268,7 @@ def complete_softwarechannel_listerrata(self, text, line, beg, end):
return tab_completer(self.do_softwarechannel_list('', True), text)
def do_softwarechannel_listerrata(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_softwarechannel_listerrata()
@@ -320,7 +320,7 @@ def complete_softwarechannel_delete(self, text, line, beg, end):
return tab_completer(self.do_softwarechannel_list('', True), text)
def do_softwarechannel_delete(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_softwarechannel_delete()
@@ -385,7 +385,7 @@ def complete_softwarechannel_clone(self, text, line, beg, end):
return tab_completer(self.do_softwarechannel_list('', True), text)
def do_softwarechannel_clone(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_softwarechannel_clone()
@@ -443,7 +443,7 @@ def complete_softwarechannel_addpackages(self, text, line, beg, end):
return tab_completer(self.get_package_names(True), text)
def do_softwarechannel_addpackages(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_softwarechannel_addpackages()
@@ -492,7 +492,7 @@ def complete_softwarechannel_removeerrata(self, text, line, beg,
end):
return self.tab_complete_errata(text)
def do_softwarechannel_removeerrata(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_softwarechannel_removeerrata()
@@ -580,7 +580,7 @@ def complete_softwarechannel_removepackages(self, text, line, beg,
return tab_completer(package_names, text)
def do_softwarechannel_removepackages(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_softwarechannel_removepackages()
@@ -634,7 +634,7 @@ def complete_softwarechannel_adderratabydate(self, text, line, beg,
end):
text)
def do_softwarechannel_adderratabydate(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 4:
self.help_softwarechannel_adderratabydate()
@@ -687,7 +687,7 @@ def complete_softwarechannel_adderrata(self, text, line, beg, end):
return self.tab_complete_errata(text)
def do_softwarechannel_adderrata(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 3:
self.help_softwarechannel_adderrata()
diff --git a/spacecmd/src/lib/ssm.py b/spacecmd/src/lib/ssm.py
index 377ab33..cf21c99 100644
--- a/spacecmd/src/lib/ssm.py
+++ b/spacecmd/src/lib/ssm.py
@@ -54,7 +54,7 @@ def complete_ssm_add(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_ssm_add(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_ssm_add()
@@ -96,7 +96,7 @@ def complete_ssm_intersect(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_ssm_intersect(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_ssm_intersect()
@@ -136,7 +136,7 @@ def complete_ssm_remove(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_ssm_remove(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_ssm_remove()
diff --git a/spacecmd/src/lib/system.py b/spacecmd/src/lib/system.py
index 4ce2269..f8e8f4a 100644
--- a/spacecmd/src/lib/system.py
+++ b/spacecmd/src/lib/system.py
@@ -72,7 +72,7 @@ def print_package_comparison(self, results):
####################
def manipulate_child_channels(self, args, remove=False):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
if remove:
@@ -154,7 +154,7 @@ def complete_system_reboot(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_reboot(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_reboot()
@@ -190,7 +190,7 @@ def help_system_search(self):
print '> system_search ip:192.168.82'
def do_system_search(self, args, doreturn=False):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 1:
self.help_system_search()
@@ -281,7 +281,7 @@ def complete_system_runscript(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_runscript(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_runscript()
@@ -416,7 +416,7 @@ def complete_system_listhardware(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_listhardware(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_listhardware()
@@ -542,7 +542,7 @@ def complete_system_installpackage(self, text, line, beg, end):
return tab_completer(self.get_package_names(), text)
def do_system_installpackage(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_system_installpackage()
@@ -662,7 +662,7 @@ def complete_system_removepackage(self, text, line, beg, end):
return tab_completer(self.get_package_names(), text)
def do_system_removepackage(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_system_removepackage()
@@ -758,7 +758,7 @@ def complete_system_upgradepackage(self, text, line, beg, end):
return tab_completer(self.get_package_names(), text)
def do_system_upgradepackage(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_system_upgradepackage()
@@ -848,7 +848,7 @@ def complete_system_listupgrades(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_listupgrades(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_listupgrades()
@@ -899,7 +899,7 @@ def complete_system_listinstalledpackages(self, text, line, beg,
end):
return self.tab_complete_systems(text)
def do_system_listinstalledpackages(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_listinstalledpackages()
@@ -941,7 +941,7 @@ def complete_system_listconfigchannels(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_listconfigchannels(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_listconfigchannels()
@@ -993,7 +993,7 @@ def complete_system_addconfigchannels(self, text, line, beg, end):
text)
def do_system_addconfigchannels(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_system_addconfigchannels()
@@ -1040,7 +1040,7 @@ def complete_system_removeconfigchannels(self, text, line, beg,
end):
text)
def do_system_removeconfigchannels(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_system_removeconfigchannels()
@@ -1073,7 +1073,7 @@ def complete_system_setconfigchannelorder(self, text, line, beg,
end):
return self.tab_complete_systems(text)
def do_system_setconfigchannelorder(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_setconfigchannelorder()
@@ -1123,7 +1123,7 @@ def complete_system_deployconfigfiles(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_deployconfigfiles(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_deployconfigfiles()
@@ -1166,7 +1166,7 @@ def complete_system_delete(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_delete(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_delete()
@@ -1241,7 +1241,7 @@ def complete_system_lock(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_lock(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_lock()
@@ -1271,7 +1271,7 @@ def complete_system_unlock(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_unlock(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_unlock()
@@ -1300,7 +1300,7 @@ def complete_system_rename(self, text, line, beg, end):
return tab_completer(self.get_system_names(), text)
def do_system_rename(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 2:
self.help_system_rename()
@@ -1338,7 +1338,7 @@ def complete_system_listcustomvalues(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_listcustomvalues(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_listcustomvalues()
@@ -1385,7 +1385,7 @@ def complete_system_addcustomvalue(self, text, line, beg, end):
text)
def do_system_addcustomvalue(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 3:
self.help_system_addcustomvalue()
@@ -1426,7 +1426,7 @@ def complete_system_updatecustomvalue(self, text, line, beg, end):
text)
def do_system_updatecustomvalue(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 3:
self.help_system_updatecustomvalue()
@@ -1452,7 +1452,7 @@ def complete_system_removecustomvalues(self, text, line, beg, end):
text)
def do_system_removecustomvalues(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_system_removecustomvalues()
@@ -1488,7 +1488,7 @@ def complete_system_addnote(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_addnote(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 1:
self.help_system_addnote()
@@ -1523,7 +1523,7 @@ def complete_system_deletenotes(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_deletenotes(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_listnotes()
@@ -1571,7 +1571,7 @@ def complete_system_listnotes(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_listnotes(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_listnotes()
@@ -1619,7 +1619,7 @@ def complete_system_setbasechannel(self, text, line, beg, end):
return tab_completer(self.list_base_channels(), text)
def do_system_setbasechannel(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 2:
self.help_system_setbasechannel()
@@ -1671,7 +1671,7 @@ def complete_system_listbasechannel(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_listbasechannel(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_listbasechannel()
@@ -1713,7 +1713,7 @@ def complete_system_listchildchannels(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_listchildchannels(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_listchildchannels()
@@ -1793,7 +1793,7 @@ def complete_system_details(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_details(self, args, short=False):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_details()
@@ -1914,7 +1914,7 @@ def complete_system_listerrata(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_listerrata(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_listerrata()
@@ -1961,7 +1961,7 @@ def complete_system_applyerrata(self, text, line, beg, end):
return self.tab_complete_errata(text)
def do_system_applyerrata(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_system_applyerrata()
@@ -1994,7 +1994,7 @@ def complete_system_listevents(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_listevents(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_listevents()
@@ -2038,7 +2038,7 @@ def complete_system_listentitlements(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_listentitlements(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_system_listentitlements()
@@ -2084,7 +2084,7 @@ def complete_system_addentitlements(self, text, line, beg, end):
return tab_completer(self.ENTITLEMENTS, text)
def do_system_addentitlements(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_system_addentitlements()
@@ -2128,7 +2128,7 @@ def complete_system_removeentitlement(self, text, line, beg, end):
return tab_completer(self.ENTITLEMENTS, text)
def do_system_removeentitlement(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_system_removeentitlement()
@@ -2220,7 +2220,7 @@ def complete_system_createpackageprofile(self, text, line, beg,
end):
return self.tab_complete_systems(text)
def do_system_createpackageprofile(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 1:
self.help_system_createpackageprofile()
@@ -2261,7 +2261,7 @@ def complete_system_comparepackageprofile(self, text, line, beg,
end):
self.do_system_listpackageprofiles('', True), parts[-1])
def do_system_comparepackageprofile(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) < 2:
self.help_system_comparepackageprofile()
@@ -2305,7 +2305,7 @@ def complete_system_comparepackages(self, text, line, beg, end):
return self.tab_complete_systems(text)
def do_system_comparepackages(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 2:
self.help_system_comparepackages()
diff --git a/spacecmd/src/lib/user.py b/spacecmd/src/lib/user.py
index b3e37d9..71d835a 100644
--- a/spacecmd/src/lib/user.py
+++ b/spacecmd/src/lib/user.py
@@ -68,7 +68,7 @@ def complete_user_delete(self, text, line, beg, end):
return tab_completer(self.do_user_list('', True), text)
def do_user_delete(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 1:
self.help_user_delete()
@@ -89,7 +89,7 @@ def complete_user_disable(self, text, line, beg, end):
return tab_completer(self.do_user_list('', True), text)
def do_user_disable(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 1:
self.help_user_disable()
@@ -109,7 +109,7 @@ def complete_user_enable(self, text, line, beg, end):
return tab_completer(self.do_user_list('', True), text)
def do_user_enable(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 1:
self.help_user_enable()
@@ -166,7 +166,7 @@ def complete_user_addrole(self, text, line, beg, end):
text)
def do_user_addrole(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 2:
self.help_user_addrole()
@@ -194,7 +194,7 @@ def complete_user_removerole(self, text, line, beg, end):
return tab_completer(roles, text)
def do_user_removerole(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 2:
self.help_user_removerole()
@@ -215,7 +215,7 @@ def complete_user_details(self, text, line, beg, end):
return tab_completer(self.do_user_list('', True), text)
def do_user_details(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if not len(args):
self.help_user_details()
@@ -290,7 +290,7 @@ def complete_user_addgroup(self, text, line, beg, end):
return tab_completer(self.do_group_list('', True), parts[-1])
def do_user_addgroup(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 2:
self.help_user_addgroup()
@@ -320,7 +320,7 @@ def complete_user_adddefaultgroup(self, text, line, beg, end):
return tab_completer(self.do_group_list('', True), parts[-1])
def do_user_adddefaultgroup(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 2:
self.help_user_adddefaultgroup()
@@ -352,7 +352,7 @@ def complete_user_removegroup(self, text, line, beg, end):
return tab_completer([ g.get('name') for g in groups ], parts[-1])
def do_user_removegroup(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 2:
self.help_user_removegroup()
@@ -386,7 +386,7 @@ def complete_user_removedefaultgroup(self, text, line, beg, end):
return tab_completer([ g.get('name') for g in groups ], parts[-1])
def do_user_removedefaultgroup(self, args):
- args = parse_arguments(args)
+ (args, options) = parse_arguments(args)
if len(args) != 2:
self.help_user_removedefaultgroup()
diff --git a/spacecmd/src/lib/utils.py b/spacecmd/src/lib/utils.py
index 6d4a803..df38b20 100644
--- a/spacecmd/src/lib/utils.py
+++ b/spacecmd/src/lib/utils.py
@@ -22,19 +22,23 @@
import logging, os, pickle, re, readline, shlex, sys, time, xmlrpclib
from datetime import datetime, timedelta
+from optparse import OptionParser
from tempfile import mkstemp
from textwrap import wrap
__EDITORS = ['vim', 'vi', 'nano', 'emacs']
-def parse_arguments(args):
+def parse_arguments(args, options = []):
try:
parts = shlex.split(args)
# allow simple globbing
parts = [re.sub('\*', '.*', a) for a in parts]
- return parts
+ parser = OptionParser(option_list = options)
+ (options, leftovers) = parser.parse_args(args = parts)
+
+ return leftovers, options
except IndexError:
return []