From 08c5d00a619edb79d36656190a47bf4652fb043b Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Thu, 11 Jun 2020 17:48:49 +0100
Subject: [PATCH] Fix kayobe baremetal compute commands

Since adding support for Python 3, the following commands fail:

* kayobe baremetal compute inspect
* kayobe baremetal compute manage
* kayobe baremetal compute provide

There are two issues:

1. There is a missing /bin from the ansible_python_interpreter path used.

2. The stackhpc.os-ironic-nodes role fails with an undefined variable:

    name 'openstack_cloud_from_module' is not defined

This is fixed in the stackhpc.os-ironic-nodes role version 1.3.1.

Story: 2007797
Task: 40051

Change-Id: Ie2a0a6bf75dc88458796a9691891e76f578d87ad
---
 ansible/baremetal-compute-inspect.yml                 |  2 +-
 ansible/baremetal-compute-manage.yml                  |  4 ++--
 ansible/baremetal-compute-provide.yml                 |  2 +-
 ...x-baremetal-compute-commands-b72862a53f88c5ef.yaml | 11 +++++++++++
 requirements.yml                                      |  2 +-
 5 files changed, 16 insertions(+), 5 deletions(-)
 create mode 100644 releasenotes/notes/fix-baremetal-compute-commands-b72862a53f88c5ef.yaml

diff --git a/ansible/baremetal-compute-inspect.yml b/ansible/baremetal-compute-inspect.yml
index 5c979529..f6319c82 100644
--- a/ansible/baremetal-compute-inspect.yml
+++ b/ansible/baremetal-compute-inspect.yml
@@ -24,7 +24,7 @@
   vars:
     controller_host: "{{ groups['controllers'][0] }}"
     venv: "{{ virtualenv_path }}/openstacksdk"
-    ansible_python_interpreter: "{{ venv }}/python"
+    ansible_python_interpreter: "{{ venv }}/bin/python"
     # Whether to wait for the state transition to complete.
     baremetal_compute_wait: True
     # Time to wait for state transition to complete, if baremetal_compute_wait
diff --git a/ansible/baremetal-compute-manage.yml b/ansible/baremetal-compute-manage.yml
index 0cae4174..27f1fce8 100644
--- a/ansible/baremetal-compute-manage.yml
+++ b/ansible/baremetal-compute-manage.yml
@@ -6,7 +6,7 @@
 # We install openstacksdk in a virtualenv on one of the controllers, and delegate to
 # it when executing the stackhpc.os-ironic-state role.
 
-- name: Ensure baremetal compute nodes are available in ironic
+- name: Ensure baremetal compute nodes are manageable in ironic
   hosts: controllers[0]
   gather_facts: true
   vars:
@@ -23,7 +23,7 @@
   gather_facts: False
   vars:
     venv: "{{ virtualenv_path }}/openstacksdk"
-    ansible_python_interpreter: "{{ venv }}/python"
+    ansible_python_interpreter: "{{ venv }}/bin/python"
     # Whether to wait for the state transition to complete.
     baremetal_compute_wait: True
     # Time to wait for state transition to complete, if baremetal_compute_wait
diff --git a/ansible/baremetal-compute-provide.yml b/ansible/baremetal-compute-provide.yml
index 615e3d05..7361c4e6 100644
--- a/ansible/baremetal-compute-provide.yml
+++ b/ansible/baremetal-compute-provide.yml
@@ -23,7 +23,7 @@
   gather_facts: False
   vars:
     venv: "{{ virtualenv_path }}/openstacksdk"
-    ansible_python_interpreter: "{{ venv }}/python"
+    ansible_python_interpreter: "{{ venv }}/bin/python"
     # Whether to wait for the state transition to complete.
     baremetal_compute_wait: True
     # Time to wait for state transition to complete, if baremetal_compute_wait
diff --git a/releasenotes/notes/fix-baremetal-compute-commands-b72862a53f88c5ef.yaml b/releasenotes/notes/fix-baremetal-compute-commands-b72862a53f88c5ef.yaml
new file mode 100644
index 00000000..f9f3450a
--- /dev/null
+++ b/releasenotes/notes/fix-baremetal-compute-commands-b72862a53f88c5ef.yaml
@@ -0,0 +1,11 @@
+---
+fixes:
+  - |
+    Fixes issues running the following commands:
+
+    - ``kayobe baremetal compute inspect``
+    - ``kayobe baremetal compute manage``
+    - ``kayobe baremetal compute provide``
+
+    See `story 2007797 <https://storyboard.openstack.org/#!/story/2007797>`__
+    for details.
diff --git a/requirements.yml b/requirements.yml
index c5bb3a68..7a1d670c 100644
--- a/requirements.yml
+++ b/requirements.yml
@@ -32,7 +32,7 @@
 - src: stackhpc.os-images
   version: v1.9.0
 - src: stackhpc.os-ironic-state
-  version: v1.3.0
+  version: v1.3.1
 - src: stackhpc.os-networks
   version: v1.4.0
 - src: stackhpc.os-openstackclient
-- 
GitLab