diff --git a/cloud_node_agent.py b/cloud_node_agent.py index 2882d71..ba90491 100644 --- a/cloud_node_agent.py +++ b/cloud_node_agent.py @@ -17,7 +17,6 @@ for task in tasks['results']: if task['task'] == 'container_create': # TODO: update task status to 1 nodeclient.task_status_update(task['id'], 1) - print task['id'] container_id = task['plain']['container_id'] ipv4 = dict() @@ -39,6 +38,10 @@ for task in tasks['results']: node.__container_authkey_create(container_id, task['plain']['ssh_key']) param_auth_key = '--auth-key /var/lib/gocloud/node/auth-keys/%s.pub' % container_id + param_packages = '' + if template == 'ubuntu': + param_packages = '--packages %s' % ','.join(config.packages['ubuntu']) + # create container lxc.lxc().create( container_id, @@ -48,7 +51,8 @@ for task in tasks['results']: "%s --user %s --password %s" % ( param_auth_key, task['plain']['username'], - task['plain']['password'] + task['plain']['password'], + param_packages ) ) lxc.lxc().start(container_id) @@ -83,5 +87,4 @@ for task in tasks['results']: nodeclient.task_status_update(task['id'], 1) container_id = task['plain']['container_id'] lxc.lxc().destroy(container_id) - nodeclient.task_status_update(task['id'], 2) diff --git a/config.py b/config.py index dc05a99..cc1eadd 100644 --- a/config.py +++ b/config.py @@ -2,3 +2,6 @@ server = 'localhost:5000' node_id = "f411b7d6-bf93-4fcd-91ee-03e5343d0187" node_secret = "b3c9a8b0-95ca-11e5-bec1-28d244e159e9" interface = 'br0:0' +packages = { + 'ubuntu': ['fail2ban'] +}