Merge "Create zuul.executor.hostname ansible variable" into feature/zuulv3
diff --git a/tests/fixtures/config/ansible/git/common-config/playbooks/check-vars.yaml b/tests/fixtures/config/ansible/git/common-config/playbooks/check-vars.yaml
new file mode 100644
index 0000000..92c66d1
--- /dev/null
+++ b/tests/fixtures/config/ansible/git/common-config/playbooks/check-vars.yaml
@@ -0,0 +1,15 @@
+- hosts: ubuntu-xenial
+ tasks:
+ - name: Assert nodepool variables are valid.
+ assert:
+ that:
+ - nodepool_az == 'test-az'
+ - nodepool_region == 'test-region'
+ - nodepool_provider == 'test-provider'
+
+ - name: Assert zuul-executor variables are valid.
+ assert:
+ that:
+ - zuul.executor.hostname is defined
+ - zuul.executor.src_root is defined
+ - zuul.executor.log_root is defined
diff --git a/tests/fixtures/config/ansible/git/common-config/playbooks/nodepool.yaml b/tests/fixtures/config/ansible/git/common-config/playbooks/nodepool.yaml
deleted file mode 100644
index 9970dd7..0000000
--- a/tests/fixtures/config/ansible/git/common-config/playbooks/nodepool.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-- hosts: ubuntu-xenial
- tasks:
- - name: Assert nodepool variables are valid.
- assert:
- that:
- - nodepool_az == 'test-az'
- - nodepool_region == 'test-region'
- - nodepool_provider == 'test-provider'
diff --git a/tests/fixtures/config/ansible/git/common-config/zuul.yaml b/tests/fixtures/config/ansible/git/common-config/zuul.yaml
index 50f353d..5c6c998 100644
--- a/tests/fixtures/config/ansible/git/common-config/zuul.yaml
+++ b/tests/fixtures/config/ansible/git/common-config/zuul.yaml
@@ -50,7 +50,7 @@
- job:
parent: python27
- name: nodepool
+ name: check-vars
nodes:
- name: ubuntu-xenial
image: ubuntu-xenial
diff --git a/tests/fixtures/config/ansible/git/org_project/.zuul.yaml b/tests/fixtures/config/ansible/git/org_project/.zuul.yaml
index 24ba019..a2d9c6f 100644
--- a/tests/fixtures/config/ansible/git/org_project/.zuul.yaml
+++ b/tests/fixtures/config/ansible/git/org_project/.zuul.yaml
@@ -8,5 +8,5 @@
jobs:
- python27
- faillocal
- - nodepool
+ - check-vars
- timeout
diff --git a/tests/unit/test_v3.py b/tests/unit/test_v3.py
index 5c0679d..fe8d560 100644
--- a/tests/unit/test_v3.py
+++ b/tests/unit/test_v3.py
@@ -266,7 +266,7 @@
self.assertEqual(build.result, 'ABORTED')
build = self.getJobFromHistory('faillocal')
self.assertEqual(build.result, 'FAILURE')
- build = self.getJobFromHistory('nodepool')
+ build = self.getJobFromHistory('check-vars')
self.assertEqual(build.result, 'SUCCESS')
build = self.getJobFromHistory('python27')
self.assertEqual(build.result, 'SUCCESS')
diff --git a/zuul/executor/server.py b/zuul/executor/server.py
index cae0f6a..60b30c7 100644
--- a/zuul/executor/server.py
+++ b/zuul/executor/server.py
@@ -826,8 +826,10 @@
with open(self.jobdir.vars, 'w') as vars_yaml:
zuul_vars = dict(args['vars'])
- zuul_vars['zuul']['executor'] = dict(src_root=self.jobdir.src_root,
- log_root=self.jobdir.log_root)
+ zuul_vars['zuul']['executor'] = dict(
+ hostname=self.executor_server.hostname,
+ src_root=self.jobdir.src_root,
+ log_root=self.jobdir.log_root)
vars_yaml.write(
yaml.safe_dump(zuul_vars, default_flow_style=False))
self.writeAnsibleConfig(self.jobdir.untrusted_config)