~bac/charmworld/tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/lib/proof.py

  • Committer: Matthew Scott
  • Date: 2014-03-06 20:32:51 UTC
  • mfrom: (489 trunk)
  • mto: This revision was merged to the branch mainline in revision 490.
  • Revision ID: matthew.scott@canonical.com-20140306203251-ve388tpu1av0coqz
Merge with trunk to resolve conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
        }
21
21
 
22
22
        if not charm.options:
23
 
            raise ProofError([
24
 
                'Looking at charm id: ' + charm._id],
25
 
                'The charm has no options.'
26
 
            )
 
23
            raise ProofError(
 
24
                ['Looking at charm id: ' + charm._id],
 
25
                'The charm has no options.')
27
26
 
28
27
        if test_key not in charm.options:
29
28
            raise ProofError([
30
29
                'Looking at charm id: ' + charm._id,
31
30
                'Found config keys: ' + str(charm.options.keys())],
32
 
                'The charm has no option for: ' + test_key
33
 
            )
 
31
                'The charm has no option for: ' + test_key)
34
32
 
35
33
        # The config key is a valid one for this charm. Check that the value
36
34
        # is of the right type.
46
44
                msg % (test_key, specified_type)
47
45
            )
48
46
 
49
 
        msg = "%s is not of type %s."
50
47
        if type(test_value) not in valid_types:
 
48
            msg = "%s is not of type %s."
51
49
            raise ProofError(
52
50
                ['Looking at charm id: ' + charm._id],
53
 
                msg % (test_key, specified_type)
54
 
            )
 
51
                msg % (test_key, specified_type))
55
52
 
56
53
 
57
54
# XXX: The code below should be ported over to the deployer or proof libary