Merge lp:~javier.collado/utah/bug1039555-autogenerate into lp:~utah/utah/bug1039555

Proposed by Javier Collado
Status: Merged
Approved by: Javier Collado
Approved revision: 675
Merged at revision: 663
Proposed branch: lp:~javier.collado/utah/bug1039555-autogenerate
Merge into: lp:~utah/utah/bug1039555
Diff against target: 715 lines (+192/-214)
15 files modified
Makefile (+1/-0)
client-Makefile (+1/-0)
client.py (+10/-12)
docs/Makefile (+1/-0)
docs/source/conf.py (+86/-10)
docs/source/introduction.rst (+1/-1)
docs/source/man/run_install_test.py.rst (+4/-42)
docs/source/man/run_test_cobbler.py.rst (+4/-22)
docs/source/man/run_test_vm.py.rst (+4/-18)
docs/source/man/run_utah_tests.py.rst (+4/-43)
docs/source/man/utah.rst (+2/-18)
examples/run_install_test.py (+22/-14)
examples/run_test_cobbler.py (+15/-10)
examples/run_test_vm.py (+15/-10)
examples/run_utah_tests.py (+22/-14)
To merge this branch: bzr merge lp:~javier.collado/utah/bug1039555-autogenerate
Reviewer Review Type Date Requested Status
Max Brustkern (community) Approve
Review via email: mp+122855@code.launchpad.net

Description of the change

This branch makes it possible to autogenerate the man pages using the output from the parser objects in the scripts.

The trick is to generate a set of text files when the configuration file for sphinx is read. Those text files are later included in the manual pages directly.

To post a comment you must log in.
Revision history for this message
Max Brustkern (nuclearbob) wrote :

In run_install_test, machinetype and installtype both use TYPE as the metavar. It's probably not a big deal, but maybe it would make more sense to use different ones? I like the rest of this.

675. By Javier Collado

Updated TYPE to MACHINETYPE to avoid metavar duplication

Changed according to review comment from Max

Revision history for this message
Javier Collado (javier.collado) wrote :

I've changed TYPE to MACHINETYPE for the --machinetype option.

However, I've not updated TYPE to INSTALLTYPE because the long option itself is --type instead of --installtype. If you like I can update both. Please let me know what do you think.

Revision history for this message
Max Brustkern (nuclearbob) wrote :

TYPE for installtype sounds good to me, the main reason I didn't just call the variable type in the first place is that type means something in python. Woo automatic man pages!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2012-08-22 12:19:35 +0000
3+++ Makefile 2012-09-06 07:23:19 +0000
4@@ -28,5 +28,6 @@
5 rm -f utah/config
6 rm -f utah_*
7 rm -f utah-*
8+ cd docs && make clean
9
10 .PHONY: client clean manpages
11
12=== modified file 'client-Makefile'
13--- client-Makefile 2012-08-22 12:19:35 +0000
14+++ client-Makefile 2012-09-06 07:23:19 +0000
15@@ -11,5 +11,6 @@
16
17 clean:
18 rm utah/config
19+ cd docs && make clean
20
21 .PHONY: clean manpages
22
23=== modified file 'client.py'
24--- client.py 2012-09-03 08:36:00 +0000
25+++ client.py 2012-09-06 07:23:19 +0000
26@@ -14,11 +14,10 @@
27 from utah.client import exceptions
28
29
30-def process_cmdline_argparse():
31+def get_parser():
32 """
33 Process the command line arguments.
34 """
35-
36 # requires Python2.7+
37 import argparse
38
39@@ -29,8 +28,10 @@
40 parser.add_argument('-s', '--state-file',
41 help=('File to use for storing state (default "%s")'
42 % DEFAULT_STATE_FILE))
43- parser.add_argument('-f', '--format', choices=['text', 'yaml', 'json'],
44- default='yaml', help='Output format (default "yaml")')
45+ parser.add_argument('-f', '--format',
46+ choices=['text', 'yaml', 'json'],
47+ default='yaml',
48+ help='Output format (default "%(default)s")')
49 parser.add_argument('-t', '--testdir',
50 default='/var/lib/utah', help='Main test directory')
51 parser.add_argument('-r', '--runlist', type=url_argument,
52@@ -45,13 +46,7 @@
53 parser.add_argument('-d', '--debug', action='store_true',
54 help='Print debugging output')
55
56- args = parser.parse_args()
57-
58- return args
59-
60-# TODO: write <2.7 optparse version and set based on version of python
61-# being used.
62-process_cmdline = process_cmdline_argparse
63+ return parser
64
65
66 def exit(returncode, msg):
67@@ -73,7 +68,10 @@
68 """
69 The main driver for the 'utah' application.
70 """
71- args = process_cmdline()
72+ # TODO: write <2.7 optparse version and set based on version of python
73+ # being used.
74+ parser = get_parser()
75+ args = parser.parse_args()
76
77 # When resuming, this script is invoked as root by rc.local
78 # No group membership is assigned then, so root needs to be able to run
79
80=== modified file 'docs/Makefile'
81--- docs/Makefile 2012-08-07 16:06:37 +0000
82+++ docs/Makefile 2012-09-06 07:23:19 +0000
83@@ -40,6 +40,7 @@
84
85 clean:
86 -rm -rf $(BUILDDIR)/*
87+ -rm source/man/*.txt # Autogenerated content for man pages
88
89 html:
90 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
91
92=== modified file 'docs/source/conf.py'
93--- docs/source/conf.py 2012-09-05 06:59:28 +0000
94+++ docs/source/conf.py 2012-09-06 07:23:19 +0000
95@@ -12,11 +12,14 @@
96 # serve to show the default.
97
98 import sys, os
99+import itertools
100+import re
101
102 # If extensions (or modules to document with autodoc) are in another directory,
103 # add these directories to sys.path here. If the directory is relative to the
104 # documentation root, use os.path.abspath to make it absolute, like shown here.
105 sys.path.insert(0, os.path.abspath('../..'))
106+sys.path.insert(0, os.path.abspath('../../examples'))
107
108
109 class Mock(type):
110@@ -35,6 +38,78 @@
111 'apt', 'apt.cache'):
112 sys.modules[mod_name] = Mock(mod_name, (type,), {})
113
114+
115+# Autogenerate help contents for manual pages when building manual pages
116+# Note: This assumes that sphinx-build is called as in the makefile like this:
117+# /usr/bin/sphinx-build -b man <sphinx_opts>
118+if sys.argv[2] == 'man':
119+ def get_parser_strings(script_name, parser):
120+ description = parser.description
121+
122+ help_lines = parser.format_help().splitlines()
123+ options_lines = itertools.dropwhile(
124+ lambda l: l != 'optional arguments:',
125+ help_lines) # Drop usage
126+ options_lines = itertools.takewhile(
127+ lambda l: bool(l),
128+ options_lines) # Drop epilog
129+ options_lines.next() # Drop first line
130+
131+ def fix_line(line):
132+ """
133+ Remove indentation and replace curly braces with angle brackets
134+ to match the expected format
135+ """
136+ line = line[2:]
137+
138+ # Apply changes only to option lines,
139+ # not the ones with the help text
140+ if line.startswith('-'):
141+ line = line.replace('{', '<')
142+ line = line.replace('}', '>')
143+ return line
144+
145+ options_lines = [fix_line(line) for line in options_lines]
146+ options = '\n'.join(options_lines)
147+
148+ if parser.epilog is None:
149+ epilog = ''
150+ else:
151+ # Highlight program name and options
152+ epilog = parser.epilog % {'prog': '**%s**' % script_name}
153+ epilog = re.sub(r'(-\w)', r'**\1**', epilog)
154+
155+ # Duplicate backslashes to avoid dropping them
156+ # because of the rst formatting
157+ epilog = re.sub(r'\\', r'\\\\', epilog)
158+
159+ # Drop 'For example:'
160+ epilog = '\n'.join(epilog.splitlines()[1:])
161+
162+ # Use line blocks to preserve line breaks
163+ # Make sure that block is in a separate paragraph
164+ epilog = re.sub(r'^\t', '\n| ', epilog, flags=re.M, count=1)
165+ epilog = re.sub(r'^\t', '| ', epilog, flags=re.M)
166+
167+ return description, options, epilog
168+
169+ module_names = ('client', 'run_install_test', 'run_test_cobbler',
170+ 'run_test_vm', 'run_utah_tests')
171+ for module_name in module_names:
172+ module = __import__(module_name)
173+ parser = module.get_parser()
174+ if module_name == 'client':
175+ script_name = 'utah'
176+ else:
177+ script_name = '{}.py'.format(module_name)
178+ description, options, epilog = get_parser_strings(script_name, parser)
179+
180+ for section_name in ('description', 'options', 'epilog'):
181+ section = locals()[section_name]
182+ filename = 'man/{}_{}.txt'.format(module_name, section_name)
183+ with open(filename, 'w') as f:
184+ f.write(section)
185+
186 # -- General configuration -----------------------------------------------------
187
188 # If your documentation needs a minimal Sphinx version, state it here.
189@@ -230,16 +305,17 @@
190 # One entry per manual page. List of tuples
191 # (source start file, name, description, authors, manual section).
192 man_pages = [
193- ('man/utah', 'utah', u'Ubuntu Test Automation Harness',
194- [u'Canonical Ltd'], 1),
195- ('man/run_install_test.py', 'run_install_test.py', u'run_install_test.py',
196- [u'Canonical Ltd'], 1),
197- ('man/run_test_cobbler.py', 'run_test_cobbler.py', u'run_test_cobbler.py',
198- [u'Canonical Ltd'], 1),
199- ('man/run_test_vm.py', 'run_test_vm.py', u'run_test_vm.py',
200- [u'Canonical Ltd'], 1),
201- ('man/run_utah_tests.py', 'run_utah_tests.py', u'run_utah_tests.py',
202- [u'Canonical Ltd'], 1),
203+ ('man/utah', 'utah', u'UTAH client test runner',
204+ [u'Canonical Ltd'], 1),
205+ ('man/run_install_test.py', 'run_install_test.py',
206+ u'UTAH server test runner (provisioning)', [u'Canonical Ltd'], 1),
207+ ('man/run_test_cobbler.py', 'run_test_cobbler.py',
208+ u'UTAH server test runner (physical hardware)', [u'Canonical Ltd'], 1),
209+ ('man/run_test_vm.py', 'run_test_vm.py',
210+ u'UTAH server test runner (virtual hardware)',
211+ [u'Canonical Ltd'], 1),
212+ ('man/run_utah_tests.py', 'run_utah_tests.py',
213+ u'UTAH server test runner (any hardware)', [u'Canonical Ltd'], 1),
214 ]
215
216 # If true, show URL addresses after external links.
217
218=== modified file 'docs/source/introduction.rst'
219--- docs/source/introduction.rst 2012-08-20 14:54:00 +0000
220+++ docs/source/introduction.rst 2012-09-06 07:23:19 +0000
221@@ -124,7 +124,7 @@
222 Variant of architecture, i.e., armel, armhf
223 -n, --no-destroy Preserve machine after tests have run
224 -d, --debug Enable debug logging
225- -j, --json Enable json logging (Default is YAML)
226+ -j, --json Enable json logging (default is YAML)
227
228 For example::
229
230
231=== modified file 'docs/source/man/run_install_test.py.rst'
232--- docs/source/man/run_install_test.py.rst 2012-09-03 11:05:38 +0000
233+++ docs/source/man/run_install_test.py.rst 2012-09-06 07:23:19 +0000
234@@ -5,57 +5,19 @@
235
236 Synopsis
237 --------
238-**run_install_test.py** [*options*] [*runlist* ...]
239+**run_install_test.py** [options] [runlist ...]
240
241 Description
242 -----------
243-Provision a machine and run one or more UTAH runlists there
244+.. include:: run_install_test_description.txt
245
246 Options
247 -------
248--h, --help show this help message and exit
249--m <physical,virtual>, --machinetype <physical,virtual>
250- Type of machine to provision
251--e EMULATOR, --emulator EMULATOR
252- Emulator to use (kvm and qemu are supported, kvm will
253- be favored if available)
254--i IMAGE, --image IMAGE
255- Image/ISO file to use for installation
256--k KERNEL, --kernel KERNEL
257- Kernel file to use for installation
258--r INITRD, --initrd INITRD
259- InitRD file to use for installation
260--p PRESEED, --preseed PRESEED
261- Preseed file to use for installation
262--b BOOT, --boot BOOT Boot arguments for initial installation
263--x XML, --xml XML XML VM definition file
264--g GIGABYTES, --gigabytes GIGABYTES
265- Size in gigabytes of virtual disk, specify more than
266- once for multiple disks
267--s <hardy,lucid,natty,oneiric,precise,quantal>, --series <hardy,lucid,natty,oneiric,precise,quantal>
268- Series to use for installation
269--t <desktop,server,mini,alternate>, --type <desktop,server,mini,alternate>
270- Install type to use for installation
271--a <i386,amd64,arm>, --arch <i386,amd64,arm>
272- Architecture to use for installation
273--v VARIANT, --variant VARIANT
274- Variant of architecture, i.e., armel, armhf
275--n, --no-destroy Preserve machine after tests have run
276--d, --debug Enable debug logging
277--j, --json Enable json logging (Default is YAML)
278---diskbus <virtio,sata,ide>
279- Disk bus to use for customvm installation
280---name NAME Name of machine to provision (currently only supported
281- for physical machine provisioning)
282+.. include:: run_install_test_options.txt
283
284 Examples
285 --------
286-| **run_utah_tests.py** **-s** precise **-t** server **-a** i386 \\
287-| /usr/share/utah/client/examples/master.run \\
288-| 'http://people.canonical.com/~max/max_test.run'
289-
290-Provision a VM using a precise server image i386 architecture and run the two
291-given runlists.
292+.. include:: run_install_test_epilog.txt
293
294 See also
295 --------
296
297=== modified file 'docs/source/man/run_test_cobbler.py.rst'
298--- docs/source/man/run_test_cobbler.py.rst 2012-09-03 11:09:31 +0000
299+++ docs/source/man/run_test_cobbler.py.rst 2012-09-06 07:23:19 +0000
300@@ -5,37 +5,19 @@
301
302 Synopsis
303 --------
304-**run_test_cobbler.py** [*options*] [*runlist* ...]
305+**run_test_cobbler.py** [options] [runlist ...]
306
307 Description
308 -----------
309-Provision a machine using cobbler and run one or more UTAH runlists there.
310+.. include:: run_test_cobbler_description.txt
311
312 Options
313 -------
314--h, --help show this help message and exit
315--n NAME, --name NAME Name of machine to provision
316--i IMAGE, --image IMAGE
317- Image/ISO file to use for installation
318--p PRESEED, --preseed PRESEED
319- Preseed file to use for installation
320--s <hardy,lucid,natty,oneiric,precise,quantal>, --series <hardy,lucid,natty,oneiric,precise,quantal>
321- Series to use for VM creation
322--t <desktop,server,mini,alternate>, --type <desktop,server,mini,alternate>
323- Install type to use for VM creation
324--a <i386,amd64>, --arch <i386,amd64>
325- Architecture to use for VM creation
326--d, --debug Enable debug logging
327--j, --json Enable json logging (Default is YAML)
328+.. include:: run_test_cobbler_options.txt
329
330 Examples
331 --------
332-| **run_test_cobbler.py** **-s** precise **-t** server **-a** i386 \\
333-| /usr/share/utah/client/examples/master.run \\
334-| 'http://people.canonical.com/~max/max_test.run'
335-
336-Provision a machine using a precise server image i386 architecture and run the
337-two given runlists.
338+.. include:: run_test_cobbler_epilog.txt
339
340 See also
341 --------
342
343=== modified file 'docs/source/man/run_test_vm.py.rst'
344--- docs/source/man/run_test_vm.py.rst 2012-09-03 11:09:31 +0000
345+++ docs/source/man/run_test_vm.py.rst 2012-09-06 07:23:19 +0000
346@@ -5,33 +5,19 @@
347
348 Synopsis
349 --------
350-run_test_vm.py [**options**] [**runlist** ...]
351+**run_test_vm.py** [options] [runlist ...]
352
353 Description
354 -----------
355-Create a virtual machine and run a UTAH runlist there.
356+.. include:: run_test_vm_description.txt
357
358 Options
359 -------
360--h, --help show this help message and exit
361--s <hardy,lucid,natty,oneiric,precise,quantal>, --series <hardy,lucid,natty,oneiric,precise,quantal>
362- Series to use for VM creation
363--t <desktop,server,mini,alternate>, --type <desktop,server,mini,alternate>
364- Install type to use for VM creation
365--a <i386,amd64>, --arch <i386,amd64>
366- Architecture to use for VM creation
367--n, --no-destroy Preserve VM after tests have run
368--d, --debug Enable debug logging
369--j, --json Enable json logging (Default is YAML)
370+.. include:: run_test_vm_options.txt
371
372 Examples
373 --------
374-| **run_test_vm.py** **-s** precise **-t** server **-a** i386 \\
375-| /usr/share/utah/client/examples/master.run \\
376-| 'http://people.canonical.com/~max/max_test.run'
377-
378-Provision a VM using a precise server image i386 architecture and run the two
379-given runlists.
380+.. include:: run_test_vm_epilog.txt
381
382 See also
383 --------
384
385=== modified file 'docs/source/man/run_utah_tests.py.rst'
386--- docs/source/man/run_utah_tests.py.rst 2012-09-03 11:09:31 +0000
387+++ docs/source/man/run_utah_tests.py.rst 2012-09-06 07:23:19 +0000
388@@ -5,58 +5,19 @@
389
390 Synopsis
391 --------
392-run_utah_tests.py [**options**] [**runlist** ...]
393+**run_utah_tests.py** [options] [runlist ...]
394
395 Description
396 -----------
397-Provision a machine using cobbler and run one or more UTAH runlists there.
398+.. include:: run_utah_tests_description.txt
399
400 Options
401 -------
402--h, --help show this help message and exit
403--m <physical,virtual>, --machinetype <physical,virtual>
404- Type of machine to provision
405--e EMULATOR, --emulator EMULATOR
406- Emulator to use (kvm and qemu are supported, kvm will
407- be favored if available)
408--i IMAGE, --image IMAGE
409- Image/ISO file to use for installation
410--k KERNEL, --kernel KERNEL
411- Kernel file to use for installation
412--r INITRD, --initrd INITRD
413- InitRD file to use for installation
414--p PRESEED, --preseed PRESEED
415- Preseed file to use for installation
416--b BOOT, --boot BOOT Boot arguments for initial installation
417--x XML, --xml XML XML VM definition file
418--g GIGABYTES, --gigabytes GIGABYTES
419- Size in gigabytes of virtual disk, specify more than
420- once for multiple disks
421--s <hardy,lucid,natty,oneiric,precise,quantal>, --series <hardy,lucid,natty,oneiric,precise,quantal>
422- Series to use for installation
423--t <desktop,server,mini,alternate>, --type <desktop,server,mini,alternate>
424- Install type to use for installation
425--a <i386,amd64,arm>, --arch <i386,amd64,arm>
426- Architecture to use for installation
427--v VARIANT, --variant VARIANT
428- Variant of architecture, i.e., armel, armhf
429--n, --no-destroy Preserve machine after tests have run
430--d, --debug Enable debug logging
431--j, --json Enable json logging (Default is YAML)
432---diskbus <virtio,sata,ide>
433- Disk bus to use for customvm installation
434---name NAME Name of machine to provision (currently only supported
435- for physical machine provisioning)
436-
437+.. include:: run_utah_tests_options.txt
438
439 Examples
440 --------
441-| **run_utah_tests.py** **-s** precise **-t** server **-a** i386 \\
442-| /usr/share/utah/client/examples/master.run \\
443-| 'http://people.canonical.com/~max/max_test.run'
444-
445-Provision a VM using a precise server image i386 architecture and run the two
446-given runlists.
447+.. include:: run_utah_tests_epilog.txt
448
449 See also
450 --------
451
452=== modified file 'docs/source/man/utah.rst'
453--- docs/source/man/utah.rst 2012-09-03 10:42:26 +0000
454+++ docs/source/man/utah.rst 2012-09-06 07:23:19 +0000
455@@ -5,28 +5,12 @@
456
457 Synopsis
458 --------
459-
460 **utah** [options]
461
462 Description
463 -----------
464-
465-:program:`utah` executes a runlist and generates a file with the results
466+.. include:: client_description.txt
467
468 Options
469 -------
470--h, --help show this help message and exit
471---resume Continue a previous run. Used after a reboot
472--s STATE_FILE, --state-file STATE_FILE
473- File to use for storing state (default
474- "/var/lib/utah/state.yaml")
475--f <text,yaml,json>, --format <text,yaml,json>
476- Output format (default "yaml")
477--t TESTDIR, --testdir TESTDIR
478- Main test directory
479--r RUNLIST, --runlist RUNLIST
480- runlist file name
481--o OUTPUT, --output OUTPUT
482- write output to this file
483--a, --append append to output
484--d, --debug Print debugging output
485+.. include:: client_options.txt
486
487=== modified file 'examples/run_install_test.py'
488--- examples/run_install_test.py 2012-08-20 20:56:16 +0000
489+++ examples/run_install_test.py 2012-09-06 07:23:19 +0000
490@@ -16,14 +16,17 @@
491 description=('Provision a machine '
492 'and run one or more UTAH runlists there.'),
493 epilog=("For example:\n"
494- "\t%(prog)s -s precise -t server -a i386 "
495- "/usr/share/utah/client/examples/master.run "
496- "'http://people.canonical.com/~max/max_test.run'"),
497+ "Provision a VM using a precise server image "
498+ "with i386 architecture and run the two given runlists\n"
499+ "\t%(prog)s -s precise -t server -a i386 \\\n"
500+ "\t\t/usr/share/utah/client/examples/master.run \\\n"
501+ "\t\t'http://people.canonical.com/~max/max_test.run'"),
502 formatter_class=argparse.RawDescriptionHelpFormatter)
503 parser.add_argument('runlists', metavar='runlist', nargs='+',
504 type=url_argument, help='URLs of runlist files to run')
505- parser.add_argument('-m', '--machinetype', choices=('physical', 'virtual'),
506- default='virtual', help='Type of machine to provision')
507+ parser.add_argument('-m', '--machinetype', metavar='MACHINETYPE',
508+ choices=('physical', 'virtual'), default='virtual',
509+ help='Type of machine to provision (%(choices)s)')
510 parser.add_argument('-e', '--emulator',
511 help=('Emulator to use (kvm and qemu are supported, '
512 'kvm will be favored if available)'))
513@@ -42,15 +45,18 @@
514 parser.add_argument('-g', '--gigabytes', action='append',
515 help=('Size in gigabytes of virtual disk, '
516 'specify more than once for multiple disks'))
517- parser.add_argument('-s', '--series',
518+ parser.add_argument('-s', '--series', metavar='SERIES',
519 choices=('hardy', 'lucid', 'natty',
520 'oneiric', 'precise', 'quantal'),
521- help='Series to use for installation')
522- parser.add_argument('-t', '--type',
523+ help='Series to use for installation (%(choices)s)')
524+ parser.add_argument('-t', '--type', metavar='TYPE',
525 choices=('desktop', 'server', 'mini', 'alternate'),
526- help='Install type to use for installation')
527- parser.add_argument('-a', '--arch', choices=('i386', 'amd64', 'arm'),
528- help='Architecture to use for installation')
529+ help=('Install type to use for installation '
530+ '(%(choices)s)'))
531+ parser.add_argument('-a', '--arch', metavar='ARCH',
532+ choices=('i386', 'amd64', 'arm'),
533+ help=('Architecture to use for installation '
534+ '(%(choices)s)'))
535 parser.add_argument('-v', '--variant',
536 help='Variant of architecture, i.e., armel, armhf')
537 parser.add_argument('-n', '--no-destroy', action='store_true',
538@@ -58,9 +64,11 @@
539 parser.add_argument('-d', '--debug', action='store_true',
540 help='Enable debug logging')
541 parser.add_argument('-j', '--json', action='store_true',
542- help='Enable json logging (Default is YAML)')
543- parser.add_argument('--diskbus', choices=('virtio', 'sata', 'ide'),
544- help='Disk bus to use for customvm installation')
545+ help='Enable json logging (default is YAML)')
546+ parser.add_argument('--diskbus', metavar='DISKBUS',
547+ choices=('virtio', 'sata', 'ide'),
548+ help=('Disk bus to use for customvm installation '
549+ '(%(choices)s)'))
550 return parser
551
552
553
554=== modified file 'examples/run_test_cobbler.py'
555--- examples/run_test_cobbler.py 2012-08-20 21:06:59 +0000
556+++ examples/run_test_cobbler.py 2012-09-06 07:23:19 +0000
557@@ -16,9 +16,11 @@
558 description=('Provision a machine using cobbler '
559 'and run one or more UTAH runlists there.'),
560 epilog=("For example:\n"
561- "\t%(prog)s -s precise -t server -a i386 "
562- "/usr/share/utah/client/examples/master.run "
563- "'http://people.canonical.com/~max/max_test.run'"),
564+ "Provision a machine using a precise server image "
565+ "with i386 architecture and run the two given runlists\n"
566+ "\t%(prog)s -s precise -t server -a i386 \\\n"
567+ "\t\t/usr/share/utah/client/examples/master.run \\\n"
568+ "\t\t'http://people.canonical.com/~max/max_test.run'"),
569 formatter_class=argparse.RawDescriptionHelpFormatter)
570 parser.add_argument('runlists', metavar='runlist', nargs='+',
571 help='URLs of runlist files to run')
572@@ -27,19 +29,22 @@
573 help='Image/ISO file to use for installation')
574 parser.add_argument('-p', '--preseed', type=url_argument,
575 help='Preseed file to use for installation')
576- parser.add_argument('-s', '--series',
577+ parser.add_argument('-s', '--series', metavar='SERIES',
578 choices=('hardy', 'lucid', 'natty',
579 'oneiric', 'precise', 'quantal'),
580- help='Series to use for VM creation')
581- parser.add_argument('-t', '--type',
582+ help='Series to use for VM creation (%(choices)s)')
583+ parser.add_argument('-t', '--type', metavar='TYPE',
584 choices=('desktop', 'server', 'mini', 'alternate'),
585- help='Install type to use for VM creation')
586- parser.add_argument('-a', '--arch', choices=('i386', 'amd64'),
587- help='Architecture to use for VM creation')
588+ help=('Install type to use for VM creation '
589+ '(%(choices)s)'))
590+ parser.add_argument('-a', '--arch', metavar='ARCH',
591+ choices=('i386', 'amd64'),
592+ help=('Architecture to use for VM creation '
593+ '(%(choices)s)'))
594 parser.add_argument('-d', '--debug', action='store_true',
595 help='Enable debug logging')
596 parser.add_argument('-j', '--json', action='store_true',
597- help='Enable json logging (Default is YAML)')
598+ help='Enable json logging (default is YAML)')
599 return parser
600
601
602
603=== modified file 'examples/run_test_vm.py'
604--- examples/run_test_vm.py 2012-08-20 21:00:06 +0000
605+++ examples/run_test_vm.py 2012-09-06 07:23:19 +0000
606@@ -14,27 +14,32 @@
607 description=('Create a virtual machine '
608 'and run a UTAH runlist there.'),
609 epilog=("For example:\n"
610- "\t%(prog)s -s precise -t server -a i386 "
611- "/usr/share/utah/client/examples/master.run "
612- "'http://people.canonical.com/~max/max_test.run'"),
613+ "Provision a VM using a precise server image "
614+ "with i386 architecture and run the two given runlists\n"
615+ "\t%(prog)s -s precise -t server -a i386 \\\n"
616+ "\t\t/usr/share/utah/client/examples/master.run \\\n"
617+ "\t\t'http://people.canonical.com/~max/max_test.run'"),
618 formatter_class=argparse.RawDescriptionHelpFormatter)
619 parser.add_argument('runlists', metavar='runlist', nargs='+',
620 help='URLs of runlist files to run')
621- parser.add_argument('-s', '--series',
622+ parser.add_argument('-s', '--series', metavar='SERIES',
623 choices=('hardy', 'lucid', 'natty',
624 'oneiric', 'precise', 'quantal'),
625- help='Series to use for VM creation')
626- parser.add_argument('-t', '--type',
627+ help='Series to use for VM creation (%(choices)s)')
628+ parser.add_argument('-t', '--type', metavar='TYPE',
629 choices=('desktop', 'server', 'mini', 'alternate'),
630- help='Install type to use for VM creation')
631- parser.add_argument('-a', '--arch', choices=('i386', 'amd64'),
632- help='Architecture to use for VM creation')
633+ help=('Install type to use for VM creation '
634+ '(%(choices)s)'))
635+ parser.add_argument('-a', '--arch', metavar='ARCH',
636+ choices=('i386', 'amd64'),
637+ help=('Architecture to use for VM creation '
638+ '(%(choices)s)'))
639 parser.add_argument('-n', '--no-destroy', action='store_true',
640 help='Preserve VM after tests have run')
641 parser.add_argument('-d', '--debug', action='store_true',
642 help='Enable debug logging')
643 parser.add_argument('-j', '--json', action='store_true',
644- help='Enable json logging (Default is YAML)')
645+ help='Enable json logging (default is YAML)')
646 return parser
647
648
649
650=== modified file 'examples/run_utah_tests.py'
651--- examples/run_utah_tests.py 2012-08-14 15:42:17 +0000
652+++ examples/run_utah_tests.py 2012-09-06 07:23:19 +0000
653@@ -15,14 +15,17 @@
654 description=('Provision a machine '
655 'and run one or more UTAH runlists there.'),
656 epilog=("For example:\n"
657- "\t%(prog)s -s precise -t server -a i386 "
658- "/usr/share/utah/client/examples/master.run "
659- "'http://people.canonical.com/~max/max_test.run'"),
660+ "Provision a VM using a precise server image "
661+ "with i386 architecture and run the two given runlists\n"
662+ "\t%(prog)s -s precise -t server -a i386 \\\n"
663+ "\t\t/usr/share/utah/client/examples/master.run \\\n"
664+ "\t\t'http://people.canonical.com/~max/max_test.run'"),
665 formatter_class=argparse.RawDescriptionHelpFormatter)
666 parser.add_argument('runlists', metavar='runlist', nargs='+',
667 type=url_argument, help='URLs of runlist files to run')
668- parser.add_argument('-m', '--machinetype', choices=('physical', 'virtual'),
669- default='virtual', help='Type of machine to provision')
670+ parser.add_argument('-m', '--machinetype', metavar='MACHINETYPE',
671+ choices=('physical', 'virtual'), default='virtual',
672+ help='Type of machine to provision (%(choices)s)')
673 parser.add_argument('-e', '--emulator',
674 help=('Emulator to use (kvm and qemu are supported, '
675 'kvm will be favored if available)'))
676@@ -41,15 +44,18 @@
677 parser.add_argument('-g', '--gigabytes', action='append',
678 help=('Size in gigabytes of virtual disk, '
679 'specify more than once for multiple disks'))
680- parser.add_argument('-s', '--series',
681+ parser.add_argument('-s', '--series', metavar='SERIES',
682 choices=('hardy', 'lucid', 'natty',
683 'oneiric', 'precise', 'quantal'),
684- help='Series to use for installation')
685- parser.add_argument('-t', '--type',
686+ help='Series to use for installation (%(choices)s)')
687+ parser.add_argument('-t', '--type', metavar='TYPE',
688 choices=('desktop', 'server', 'mini', 'alternate'),
689- help='Install type to use for installation')
690- parser.add_argument('-a', '--arch', choices=('i386', 'amd64', 'arm'),
691- help='Architecture to use for installation')
692+ help=('Install type to use for installation '
693+ '(%(choices)s)'))
694+ parser.add_argument('-a', '--arch', metavar='ARCH',
695+ choices=('i386', 'amd64', 'arm'),
696+ help=('Architecture to use for installation '
697+ '(%(choices)s)'))
698 parser.add_argument('-v', '--variant',
699 help='Variant of architecture, i.e., armel, armhf')
700 parser.add_argument('-n', '--no-destroy', action='store_true',
701@@ -57,9 +63,11 @@
702 parser.add_argument('-d', '--debug', action='store_true',
703 help='Enable debug logging')
704 parser.add_argument('-j', '--json', action='store_true',
705- help='Enable json logging (Default is YAML)')
706- parser.add_argument('--diskbus', choices=('virtio', 'sata', 'ide'),
707- help='Disk bus to use for customvm installation')
708+ help='Enable json logging (default is YAML)')
709+ parser.add_argument('--diskbus', metavar='DISKBUS',
710+ choices=('virtio', 'sata', 'ide'),
711+ help=('Disk bus to use for customvm installation '
712+ '(%(choices)s)'))
713 parser.add_argument('--name', help='Name of machine to provision'
714 + ' (currently only supported for physical machine'
715 + ' provisioning)')

Subscribers

People subscribed via source and target branches

to all changes: