From 8310d2b5f62e760f9be27e86ecbc9c97c4f3bd32 Mon Sep 17 00:00:00 2001 From: Sylwester Brzeczkowski Date: Mon, 9 Nov 2015 10:57:28 +0100 Subject: [PATCH] add repos configuration possibility for bareon --- bootstrap/playbooks/pxe.yaml | 1 + examples/provisioning/provision.py | 11 ++- resources/not_provisioned_node/meta.yaml | 3 + .../templates/provisioning.json.jinja | 67 +------------------ 4 files changed, 14 insertions(+), 68 deletions(-) diff --git a/bootstrap/playbooks/pxe.yaml b/bootstrap/playbooks/pxe.yaml index f2e0e6c0..bd7ebf5b 100644 --- a/bootstrap/playbooks/pxe.yaml +++ b/bootstrap/playbooks/pxe.yaml @@ -19,6 +19,7 @@ tasks: # Istall and configure dnsmasq + - apt: update_cache=yes - apt: name=dnsmasq state=present - file: path={{tftp_root}} state=directory - template: src=files/dnsmasq_pxe.conf dest=/etc/dnsmasq.d/pxe.conf diff --git a/examples/provisioning/provision.py b/examples/provisioning/provision.py index 8a515ac7..f9b6bd2a 100755 --- a/examples/provisioning/provision.py +++ b/examples/provisioning/provision.py @@ -7,7 +7,8 @@ from solar.events.controls import React discovery_service = 'http://0.0.0.0:8881' -bareon_service = 'http://0.0.0.0:9322/v1/nodes/{0}/partitioning' +bareon_partitioning = 'http://0.0.0.0:9322/v1/nodes/{0}/partitioning' +bareon_repos = 'http://0.0.0.0:9322/v1/nodes/{0}/repos' bareon_sync = 'http://0.0.0.0:9322/v1/actions/sync_all' @@ -25,7 +26,12 @@ class NodeAdapter(dict): @property def partitioning(self): - return requests.get(bareon_service.format(self['id'])).json() + return requests.get(bareon_partitioning.format(self['id'])).json() + + @property + def repos(self): + return requests.get(bareon_repos.format(self['id'])).json() + # Sync hw info about nodes from discovery service into bareon-api requests.post(bareon_sync) @@ -53,6 +59,7 @@ for node in nodes_list: { 'partitioning': node.partitioning, 'master_key': master_key, + 'repos': node.repos, } ) diff --git a/resources/not_provisioned_node/meta.yaml b/resources/not_provisioned_node/meta.yaml index 014e6d8b..9378aeba 100644 --- a/resources/not_provisioned_node/meta.yaml +++ b/resources/not_provisioned_node/meta.yaml @@ -17,6 +17,9 @@ input: admin_mac: schema: str! value: + repos: + schema: list! + value: [] name: schema: str value: a node diff --git a/resources/not_provisioned_node/templates/provisioning.json.jinja b/resources/not_provisioned_node/templates/provisioning.json.jinja index 2c287657..74ef406c 100644 --- a/resources/not_provisioned_node/templates/provisioning.json.jinja +++ b/resources/not_provisioned_node/templates/provisioning.json.jinja @@ -43,72 +43,7 @@ "local": "/var/www/nailgun/ubuntu/x86_64/images/linux", "remote_relative": "dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux" }, - "repos": [ - { - "name": "ubuntu", - "section": "main universe multiverse", - "uri": "http://archive.ubuntu.com/ubuntu/", - "priority": null, - "suite": "trusty", - "type": "deb" - }, - { - "name": "ubuntu-updates", - "section": "main universe multiverse", - "uri": "http://archive.ubuntu.com/ubuntu/", - "priority": null, - "suite": "trusty-updates", - "type": "deb" - }, - { - "name": "ubuntu-security", - "section": "main universe multiverse", - "uri": "http://archive.ubuntu.com/ubuntu/", - "priority": null, - "suite": "trusty-security", - "type": "deb" - }, - { - "name": "mos", - "section": "main restricted", - "uri": "http://127.0.0.1:8080/2015.1.0-7.0/ubuntu/x86_64", - "priority": 1050, - "suite": "mos7.0", - "type": "deb" - }, - { - "name": "mos-updates", - "section": "main restricted", - "uri": "http://mirror.fuel-infra.org/mos/ubuntu/", - "priority": 1050, - "suite": "mos7.0-updates", - "type": "deb" - }, - { - "name": "mos-security", - "section": "main restricted", - "uri": "http://mirror.fuel-infra.org/mos/ubuntu/", - "priority": 1050, - "suite": "mos7.0-security", - "type": "deb" - }, - { - "name": "mos-holdback", - "section": "main restricted", - "uri": "http://mirror.fuel-infra.org/mos/ubuntu/", - "priority": 1100, - "suite": "mos7.0-holdback", - "type": "deb" - }, - { - "name": "Auxiliary", - "section": "main restricted", - "uri": "http://127.0.0.1:8080/2015.1.0-7.0/ubuntu/auxiliary", - "priority": 1150, - "suite": "auxiliary", - "type": "deb" - } - ], + "repos": {{ repos | to_pretty_json }}, "metadata": { "always_editable": true, "weight": 50,