~hazmat/pyjuju/rapi-rollup

« back to all changes in this revision

Viewing changes to juju/providers/common/cloudinit.py

  • Committer: Kapil Thangavelu
  • Date: 2013-01-20 12:17:15 UTC
  • mfrom: (616.2.13 rapi-annotation)
  • Revision ID: kapil@canonical.com-20130120121715-exju6n7miobz9gmc
Merged rapi-annotation into rapi-rollup.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
        "--session-file /var/run/juju/machine-agent.zksession")
57
57
    return service.get_cloud_init_commands()
58
58
 
59
 
def _unit_scripts(machine_id, unit_name, zookeeper_hosts, juju_home):
 
59
 
 
60
def _unit_scripts(machine_id, unit_name, zookeeper_hosts, juju_home, env_id):
60
61
    unit_path_name = unit_name.replace('/', '-')
61
62
    service_name = "juju-%s" % unit_path_name
62
63
    service = UpstartService(service_name)
66
67
            {"JUJU_MACHINE_ID": str(machine_id),
67
68
             "JUJU_UNIT_NAME": unit_name,
68
69
             "JUJU_HOME": juju_home,
 
70
             "JUJU_ENV_UUID": env_id,
69
71
             "JUJU_ZOOKEEPER": zookeeper_hosts})
70
72
    service.set_output_path(
71
73
        "/var/log/juju/unit-%s-output.log" % unit_path_name)
78
80
                "/var/run/juju/unit-%s-agent.zksession" % unit_path_name]))
79
81
    return service.get_cloud_init_commands()
80
82
 
 
83
 
81
84
def _apiserver_scripts(zookeeper_hosts):
82
85
    service = UpstartService("juju-api-agent")
83
86
    service.set_description("Juju api agent")
186
189
        self._unit_name = None
187
190
        self._juju_home = None
188
191
        self._apt_proxy = None
 
192
        self._env_id = None
189
193
 
190
194
    def add_ssh_key(self, key):
191
195
        """Add an SSH public key.
239
243
            self._origin = PROPOSED
240
244
            self._origin_url = None
241
245
 
 
246
    def set_environment_id(self, id):
 
247
        """Specify the environment id.
 
248
        """
 
249
        self._env_id = id
 
250
 
242
251
    def set_machine_id(self, id):
243
252
        """Specify the juju machine ID.
244
253
 
314
323
 
315
324
    def set_apt_proxy(self, proxy):
316
325
        """Specify an apt proxy to configure
317
 
        
 
326
 
318
327
        :param proxy: proxy to set for APT using Acquire:HTTP
319
328
        :type str
320
329
        """
409
418
                self._machine_id,
410
419
                self._unit_name,
411
420
                self._join_zookeeper_hosts(),
412
 
                self._juju_home))
 
421
                self._juju_home,
 
422
                self._env_id))
413
423
        if self._provision:
414
424
            scripts.extend(_provision_scripts(self._join_zookeeper_hosts()))
415
425
            scripts.extend(_apiserver_scripts(self._join_zookeeper_hosts()))