1
Author: Kapil Thangavelu <kapil.thangavelu@canonical.com>
2
Origin: http://paste.ubuntu.com/907710/plain/
3
Forwarded: yes, r508 in trunk
4
Description: write the sample config *after* parser is initialized so that
5
--help does not need to write ~/.juju/environments.yaml
7
=== modified file 'juju/control/__init__.py'
8
--- a/juju/control/__init__.py 2012-03-28 11:21:58 +0000
9
+++ b/juju/control/__init__.py 2012-03-30 19:07:21 +0000
13
"""The main end user cli command for juju users."""
14
- env_config = EnvironmentsConfig()
15
- env_config.load_or_write_sample()
16
parser = setup_parser(
17
subcommands=SUBCOMMANDS,
19
description="juju cloud orchestration admin")
20
- parser.set_defaults(environments=env_config, log=log)
22
# Some commands, like juju ssh, do a further parse on options by
23
# delegating to another command (such as the underlying ssh). But
26
# Otherwise, do be strict
27
options = parser.parse_args(args)
29
+ env_config = EnvironmentsConfig()
30
+ env_config.load_or_write_sample()
31
+ options.environments = env_config
34
setup_logging(options)
35
options.command(options)
36
=== modified file 'juju/control/tests/test_control.py'
37
--- a/juju/control/tests/test_control.py 2011-09-15 19:24:47 +0000
38
+++ b/juju/control/tests/test_control.py 2012-03-30 22:12:10 +0000
40
let the user know it should be edited.
45
except EnvironmentsConfigError, error:
46
self.assertTrue(error.sample_written)