Merge lp:~pwlars/charms/trusty/snappy-device-agent/separate-service-dirs into lp:~canonical-hw-cert/charms/trusty/snappy-device-agent/trunk

Proposed by Paul Larson
Status: Merged
Approved by: Paul Larson
Approved revision: 7
Merged at revision: 7
Proposed branch: lp:~pwlars/charms/trusty/snappy-device-agent/separate-service-dirs
Merge into: lp:~canonical-hw-cert/charms/trusty/snappy-device-agent/trunk
Diff against target: 69 lines (+12/-6)
3 files modified
hooks/actions.py (+7/-3)
hooks/services.py (+4/-2)
templates/upstart.conf (+1/-1)
To merge this branch: bzr merge lp:~pwlars/charms/trusty/snappy-device-agent/separate-service-dirs
Reviewer Review Type Date Requested Status
Paul Larson Approve
Review via email: mp+274782@code.launchpad.net

Description of the change

This will be needed later down the road for hosting things like adb agents that may need to be combined onto a single host system.

To post a comment you must log in.
Revision history for this message
Paul Larson (pwlars) wrote :

Using this right now with snappy x86 generic, and seems to work well.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/actions.py'
--- hooks/actions.py 2015-10-05 15:10:06 +0000
+++ hooks/actions.py 2015-10-16 20:46:22 +0000
@@ -7,7 +7,7 @@
7from charmhelpers.core import hookenv7from charmhelpers.core import hookenv
8from charmhelpers.payload import (archive, execd)8from charmhelpers.payload import (archive, execd)
99
10SERVICE_NAME = 'snappy-device-agents'10SERVICE_NAME = hookenv.service_name()
11AGENT_CONFIGFILE = 'spi-agent.conf'11AGENT_CONFIGFILE = 'spi-agent.conf'
12DEVICE_CONFIGFILE = 'default.yaml'12DEVICE_CONFIGFILE = 'default.yaml'
13REQUIRED_PACKAGES = [13REQUIRED_PACKAGES = [
@@ -28,11 +28,15 @@
2828
2929
30def _service_dir():30def _service_dir():
31 template = '/srv/{}/{}'31 # This is dir where the provisioning kit will live after extraction
32 return template.format(config['environment'], SERVICE_NAME)32 # The tarball needs to extract to snappy-device-agents and we
33 # extract it from one level up
34 template = '/srv/snappy-device-agents/{}/snappy-device-agents'
35 return template.format(SERVICE_NAME)
3336
3437
35def _agent_dir():38def _agent_dir():
39 # This is the dir where the SPI Agent will live after extraction
36 template = '{}/spi-agent'40 template = '{}/spi-agent'
37 return template.format(_service_dir())41 return template.format(_service_dir())
3842
3943
=== modified file 'hooks/services.py'
--- hooks/services.py 2015-08-14 20:10:33 +0000
+++ hooks/services.py 2015-10-16 20:46:22 +0000
@@ -9,9 +9,11 @@
99
10def manage():10def manage():
11 config = hookenv.config()11 config = hookenv.config()
12 service_name = hookenv.service_name()
13 config['service_name'] = service_name
12 manager = ServiceManager([14 manager = ServiceManager([
13 {15 {
14 'service': 'snappy-proposed-selftest-agent',16 'service': 'snappy-device-agent-{}'.format(service_name),
15 'required_data': [config],17 'required_data': [config],
16 'data_ready': [18 'data_ready': [
17 actions.basenode,19 actions.basenode,
@@ -20,7 +22,7 @@
20 actions.install_python_packages,22 actions.install_python_packages,
21 helpers.render_template(23 helpers.render_template(
22 source='upstart.conf',24 source='upstart.conf',
23 target='/etc/init/snappy-proposed-selftest-agent.conf'),25 target='/etc/init/snappy-device-agent-{}.conf'.format(service_name)),
24 actions.log_start,26 actions.log_start,
25 ],27 ],
26 },28 },
2729
=== modified file 'templates/upstart.conf'
--- templates/upstart.conf 2015-08-14 20:10:33 +0000
+++ templates/upstart.conf 2015-10-16 20:46:22 +0000
@@ -11,7 +11,7 @@
11# unless it fails 15 times within 5 seconds11# unless it fails 15 times within 5 seconds
12respawn limit 15 512respawn limit 15 5
1313
14env SERVICE_DIR=/srv/{{ environment }}/snappy-device-agents14env SERVICE_DIR=/srv/snappy-device-agents/{{ service_name }}/snappy-device-agents
15env SERVICE_USER=ubuntu15env SERVICE_USER=ubuntu
1616
17script17script

Subscribers

People subscribed via source and target branches