Merge lp:~bac/charm-tools/1321316 into lp:charm-tools/1.2
Proposed by
Brad Crittenden
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 322 | ||||
Proposed branch: | lp:~bac/charm-tools/1321316 | ||||
Merge into: | lp:charm-tools/1.2 | ||||
Diff against target: |
46 lines (+16/-2) 2 files modified
charmtools/charms.py (+2/-2) tests/test_charm_proof.py (+14/-0) |
||||
To merge this branch: | bzr merge lp:~bac/charm-tools/1321316 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
charmers | Pending | ||
Review via email: mp+220286@code.launchpad.net |
Description of the change
Don't die if an option has no type.
If a config option doesn't specify a type, a warning was issued
but the process failed with KeyError. This fix allows it to proceed, using
'string' if not type is given.
This bug affects charmworld ingest, so getting it released soonish would be
great.
To post a comment you must log in.
Reviewers: mp+220286_ code.launchpad. net,
Message:
Please take a look.
Description:
Don't die if an option has no type.
If a config option doesn't specify a type, a warning was issued
but the process failed with KeyError. This fix allows it to proceed,
using
'string' if not type is given.
This bug affects charmworld ingest, so getting it released soonish would
be
great.
https:/ /code.launchpad .net/~bac/ charm-tools/ 1321316/ +merge/ 220286
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/98390047/
Affected files (+18, -2 lines): charms. py charm_proof. py
A [revision details]
M charmtools/
M tests/test_
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: charmtools/ charms. py charms. py' charms. py 2014-05-16 15:52:09 +0000 charms. py 2014-05-20 14:59:35 +0000
self. warn('config. yaml: option %s has an invalid type (%s)'
% (option_name, option_type)) TYPES[option_ value[' type']] TYPES[option_ type]
actual_ value = option_ value[' default' ]
if actual_value is None:
notify = (self.info if expected_type in
self.err(
'config. yaml: type of option %s is specified as '
'% s, but the type of the default value is %s' value[' type'],
type(actual_ value). __name_ _))
=== modified file 'charmtools/
--- charmtools/
+++ charmtools/
@@ -185,7 +185,7 @@
elif 'default' in option_value:
- expected_type = KNOWN_OPTION_
+ expected_type = KNOWN_OPTION_
ALLOW_NONE_DEFAULT
@@ -197,7 +197,7 @@
- % (option_name, option_
+ % (option_name, option_type,
else:
# Nothing to do: the option type is valid but no default
Index: tests/test_ charm_proof. py test_charm_ proof.py' charm_proof. py 2014-05-16 15:52:09 +0000 charm_proof. py 2014-05-20 14:59:35 +0000
self. linter. check_config_ file(self. charm_dir)
self. assertEqual( [], self.linter.lint)
=== modified file 'tests/
--- tests/test_
+++ tests/test_
@@ -71,6 +71,20 @@
+ def test_missing_ type_defaults_ to_string( self): config( """ check_config_ file(self. charm_dir) with_invalid_ yaml(self) :
self. write_config( """
options:
+ # A warning is issued but no failure.
+ self.write_
+ options:
+ string_opt:
+ description: A string option
+ default: some text
+ """)
+ self.linter.
+ self.assertEqual(
+ ['W: config.yaml: option string_opt does not have the keys: '
+ 'type'],
+ self.linter.lint)
+
def test_config_