~juju-deployers/juju-deployer/trunk

« back to all changes in this revision

Viewing changes to deployer/env/base.py

  • Committer: Tim Van Steenburgh
  • Date: 2016-12-24 14:25:49 UTC
  • mfrom: (206.1.5 juju-deployer)
  • Revision ID: tvansteenburgh@gmail.com-20161224142549-ieneftwad0s15pga
[timkuhlman] Add storage support

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
from ..utils import (
5
5
    AlternateKeyDict,
6
6
    ErrorExit,
 
7
    DeploymentError,
7
8
    yaml_load,
8
9
    yaml_dump,
9
10
    temp_file,
68
69
        self.log.info(" Bootstrap complete")
69
70
 
70
71
    def deploy(self, name, charm_url, repo=None, config=None,
71
 
               constraints=None, num_units=1, force_machine=None,
 
72
               constraints=None, storage=None, num_units=1, force_machine=None,
72
73
               series=None):
73
74
        params = self._named_env(["juju", "deploy"])
74
75
        with temp_file() as fh:
84
85
                        '{}={}'.format(k, v) for k, v in constraints.items()
85
86
                    ])
86
87
                params.extend(['--constraints', constraints])
 
88
            if storage:
 
89
                if not isinstance(storage, dict):
 
90
                    raise DeploymentError(
 
91
                        "storage must be specified as a dictionary")
 
92
                params.append("--storage")
 
93
                for key, value in storage.items():
 
94
                    params.append("{}={}".format(key, value))
87
95
            if num_units not in (1, None):
88
96
                params.extend(["--num-units", str(num_units)])
89
97
            if charm_url.startswith('local'):