Merge lp:~peter-petrakis/juju-deployer/devel-pydeployto into lp:~gandelman-a/juju-deployer/trunk

Proposed by Peter Petrakis
Status: Needs review
Proposed branch: lp:~peter-petrakis/juju-deployer/devel-pydeployto
Merge into: lp:~gandelman-a/juju-deployer/trunk
Diff against target: 79 lines (+57/-0)
2 files modified
configs/wiki-plus-juju-gui.yaml (+26/-0)
deployer/env/py.py (+31/-0)
To merge this branch: bzr merge lp:~peter-petrakis/juju-deployer/devel-pydeployto
Reviewer Review Type Date Requested Status
Adam Gandelman Pending
Review via email: mp+185126@code.launchpad.net

Description of the change

support force-machine on pyju, example config provided

To post a comment you must log in.

Unmerged revisions

74. By Peter Petrakis

support force-machine on pyju, example config provided

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'configs/wiki-plus-juju-gui.yaml'
2--- configs/wiki-plus-juju-gui.yaml 1970-01-01 00:00:00 +0000
3+++ configs/wiki-plus-juju-gui.yaml 2013-09-11 18:16:42 +0000
4@@ -0,0 +1,26 @@
5+wiki:
6+ series: precise
7+ services:
8+ juju_gui:
9+ charm: juju-gui
10+ branch: lp:charms/precise/juju-gui
11+ force-machine: 0
12+ expose: true
13+ wiki:
14+ charm: mediawiki
15+ branch: lp:charms/precise/mediawiki
16+ constraints: mem=2
17+ num_units: 2
18+ db:
19+ charm: mysql
20+ branch: lp:charms/precise/mysql
21+ options:
22+ tuning-level: fast
23+ haproxy:
24+ branch: lp:charms/precise/haproxy
25+ expose: true
26+ memcached:
27+ branch: lp:charms/precise/memcached
28+ relations:
29+ - ["wiki:db", db]
30+ - [wiki, [haproxy, memcached]]
31
32=== modified file 'deployer/env/py.py'
33--- deployer/env/py.py 2013-07-30 23:39:51 +0000
34+++ deployer/env/py.py 2013-09-11 18:16:42 +0000
35@@ -5,6 +5,9 @@
36
37 from .base import BaseEnvironment
38
39+from ..utils import (
40+ _get_juju_home, path_join, yaml_load, ErrorExit, yaml_dump, temp_file,
41+ _check_call)
42
43 class PyEnvironment(BaseEnvironment):
44
45@@ -33,6 +36,34 @@
46 def connect(self):
47 """ NoOp """
48
49+ def deploy(self, name, charm_url,
50+ repo=None, config=None,
51+ constraints=None, num_units=1, force_machine=None):
52+
53+ if force_machine is None:
54+ return super(PyEnvironment, self).deploy(name, charm_url,
55+ repo, config, constraints, num_units, force_machine)
56+
57+ params = self._named_env(["jitsu", "deploy-to"])
58+ params.extend(["%d" % force_machine])
59+
60+ # Silently ignore num_units
61+ with temp_file() as fh:
62+ if config:
63+ fh.write(yaml_dump({name: config}))
64+ fh.flush()
65+ params.extend(["--config", fh.name])
66+ if constraints:
67+ params.extend(['--constraints', constraints])
68+ if charm_url.startswith('local'):
69+ if repo == "":
70+ repo = "."
71+ params.extend(["--repository=%s" % repo])
72+
73+ params.extend([charm_url, name])
74+ self._check_call(
75+ params, self.log, "Error deploying service %r", name)
76+
77 def _destroy_service(self, service_name):
78 params = self._named_env(["juju", "destroy-service"])
79 params.append(service_name)

Subscribers

People subscribed via source and target branches