Browse Source

Add nodepool.host_id variable to inventory file

We recently exposed node.host_id in zookeeper from nodepool. Also
include it into the inventory file so jobs can access it.

Change-Id: Ic90af15dd86555aca2ce09120715b0aeb8af8516
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
changes/96/623496/1
Paul Belanger 3 years ago
parent
commit
0d31dba6cb
5 changed files with 9 additions and 0 deletions
  1. +5
    -0
      releasenotes/notes/host-id-inventory-e1cba009bb5a536d.yaml
  2. +1
    -0
      tests/base.py
  3. +1
    -0
      tests/fixtures/config/ansible/git/common-config/playbooks/check-vars.yaml
  4. +1
    -0
      zuul/executor/server.py
  5. +1
    -0
      zuul/model.py

+ 5
- 0
releasenotes/notes/host-id-inventory-e1cba009bb5a536d.yaml View File

@ -0,0 +1,5 @@
---
features:
- |
The Ansible inventory file now includes nodepool.host_id variable if the
node was launched using the OpenStack Nodepool driver.

+ 1
- 0
tests/base.py View File

@ -1835,6 +1835,7 @@ class FakeNodepool(object):
region='test-region',
az='test-az',
attributes=self.attributes,
host_id='test-host-id',
interface_ip=remote_ip,
public_ipv4=remote_ip,
private_ipv4=None,


+ 1
- 0
tests/fixtures/config/ansible/git/common-config/playbooks/check-vars.yaml View File

@ -5,6 +5,7 @@
that:
- nodepool.az == 'test-az'
- nodepool.cloud == 'test-cloud'
- nodepool.host_id == 'test-host-id'
- nodepool.region == 'test-region'
- nodepool.provider == 'test-provider'


+ 1
- 0
zuul/executor/server.py View File

@ -1227,6 +1227,7 @@ class AnsibleJob(object):
cloud=node.get('cloud'),
provider=node.get('provider'),
region=node.get('region'),
host_id=node.get('host_id'),
interface_ip=node.get('interface_ip'),
public_ipv4=node.get('public_ipv4'),
private_ipv4=node.get('private_ipv4'),


+ 1
- 0
zuul/model.py View File

@ -517,6 +517,7 @@ class Node(ConfigObject):
# Attributes from Nodepool
self._state = 'unknown'
self.state_time = time.time()
self.host_id = None
self.interface_ip = None
self.public_ipv4 = None
self.private_ipv4 = None


Loading…
Cancel
Save