Merge lp:~jshepher/nova/nova_manage_config_list into lp:~hudson-openstack/nova/trunk

Proposed by Justin Shepherd
Status: Merged
Approved by: Vish Ishaya
Approved revision: 1144
Merged at revision: 1152
Proposed branch: lp:~jshepher/nova/nova_manage_config_list
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 50 lines (+22/-11)
1 file modified
bin/nova-manage (+22/-11)
To merge this branch: bzr merge lp:~jshepher/nova/nova_manage_config_list
Reviewer Review Type Date Requested Status
Vish Ishaya (community) Approve
Devin Carlen (community) Approve
Review via email: mp+63419@code.launchpad.net

Description of the change

Added 'config list' to nova-manage. This function will output all of the flags and their values.

# ./bin/nova-manage config list
--storage_availability_zone=nova
--ca_file=cacert.pem
--ec2_dmz_host=$my_ip
--fixed_range=10.0.0.0/8
--compute_topic=compute
--dmz_mask=255.255.255.0
****SNIP****

I also alphabetized the nova-manage category listing

To post a comment you must log in.
Revision history for this message
Devin Carlen (devcamcar) wrote :

nice!

review: Approve
Revision history for this message
Vish Ishaya (vishvananda) wrote :

hmm, I wonder about changing this slightly...

--help prints all of the flags with descriptions nicely categorized with default values
--helpxml prints in xml the same thing + the current value of the flag

We could pretty easily override --help to add the current value of the flag which might be a little nicer than that format?

Revision history for this message
Justin Shepherd (jshepher) wrote :

--help might get a bit hard to read with all the defaults, value types, and current values.. but let me know if that is the way I should go with this.

the other option.. is to not use the string format "--dmz_mask=255.255.255.0" but to use key:value (dmz_mask: 255.255.255.0)

Revision history for this message
Justin Shepherd (jshepher) wrote :

however, in the spirit of the example postconf.. it is nice for an administrator to have a function that just spits out all of the configuration paramaters with out any descriptions or defaults.. this is very nice when you just want to grep the running config for something:

Example:

# ./bin/nova-manage config list | grep -i glance
--glance_port=9292
--glance_host=$my_ip

# ./bin/nova-manage --help | grep -A2 -i glance
  --glance_host: glance host
    (default: '$my_ip')
  --glance_port: glance port
    (default: '9292')
    (an integer)

Revision history for this message
Vish Ishaya (vishvananda) wrote :

ok. I buy that rationale.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/nova-manage'
2--- bin/nova-manage 2011-06-03 15:11:01 +0000
3+++ bin/nova-manage 2011-06-03 18:23:23 +0000
4@@ -1081,24 +1081,35 @@
5 self._convert_images(machine_images)
6
7
8+class ConfigCommands(object):
9+ """Class for exposing the flags defined by flag_file(s)."""
10+
11+ def __init__(self):
12+ pass
13+
14+ def list(self):
15+ print FLAGS.FlagsIntoString()
16+
17+
18 CATEGORIES = [
19- ('user', UserCommands),
20 ('account', AccountCommands),
21+ ('config', ConfigCommands),
22+ ('db', DbCommands),
23+ ('fixed', FixedIpCommands),
24+ ('flavor', InstanceTypeCommands),
25+ ('floating', FloatingIpCommands),
26+ ('instance_type', InstanceTypeCommands),
27+ ('image', ImageCommands),
28+ ('network', NetworkCommands),
29 ('project', ProjectCommands),
30 ('role', RoleCommands),
31+ ('service', ServiceCommands),
32 ('shell', ShellCommands),
33- ('vpn', VpnCommands),
34- ('fixed', FixedIpCommands),
35- ('floating', FloatingIpCommands),
36- ('network', NetworkCommands),
37+ ('user', UserCommands),
38+ ('version', VersionCommands),
39 ('vm', VmCommands),
40- ('service', ServiceCommands),
41- ('db', DbCommands),
42 ('volume', VolumeCommands),
43- ('instance_type', InstanceTypeCommands),
44- ('image', ImageCommands),
45- ('flavor', InstanceTypeCommands),
46- ('version', VersionCommands)]
47+ ('vpn', VpnCommands)]
48
49
50 def lazy_match(name, key_value_tuples):