From 4c04ad54365bdb31bd237412ef73a1dc088b8fda Mon Sep 17 00:00:00 2001
From: Jeremy Stanley <fungi@yuggoth.org>
Date: Fri, 26 Jul 2019 14:55:32 +0000
Subject: [PATCH] Correct emergency file reference in launch script

The launch script is referring to the wrong path for the emergency
inventory. Also correct the references in the sysadmin guide and
update the example for using it.

Change-Id: I80bdbd440ec451bcd6fb1a3eb552ffda32407c44
---
 doc/source/sysadmin.rst | 19 +++++++++++--------
 launch/launch-node.py   |  2 +-
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/doc/source/sysadmin.rst b/doc/source/sysadmin.rst
index ea19f4fbd7..136937b4d3 100644
--- a/doc/source/sysadmin.rst
+++ b/doc/source/sysadmin.rst
@@ -468,12 +468,12 @@ expected. Globs, group names and server UUIDs should all be acceptable input.
 
 If you need to disable a host immediately without waiting for a patch to land
 to `system-config`, there is a file on the bridge host,
-`/etc/ansible/hosts/emergency` that can be edited directly.
+`/etc/ansible/hosts/emergency.yaml` that can be edited directly.
 
-`/etc/ansible/hosts/emergency` is a file that should normally be empty, but
-the contents are not managed by puppet. It's purpose is to allow for disabling
-puppet at times when landing a change to the puppet repo would be either
-unreasonable or impossible.
+`/etc/ansible/hosts/emergency.yaml` is a file that should normally be empty,
+but the contents are not managed by puppet. It's purpose is to allow for
+disabling puppet at times when landing a change to the puppet repo would be
+either unreasonable or impossible.
 
 There are two sections in the emergency file, `disabled` and
 `disabled:children`. To disable a single host, put it in `disabled`. If you
@@ -492,12 +492,15 @@ Examples
 
 To disable an OpenStack instance called `amazing.openstack.org` temporarily
 without landing a puppet change, ensure the following is in
-`/etc/ansible/hosts/emergency`
+`/etc/ansible/hosts/emergency.yaml`
 
 ::
 
-  [disabled]
-  amazing.openstack.org
+  # Please add an inline comment so we know who added the host and why
+  plugin: yamlgroup
+  groups:
+    disabled:
+      - foo.opendev.org # 2020-05-23 bob is testing change 654321
 
 To disable a group of hosts in the emergency file, such as all of the pypi
 hosts.
diff --git a/launch/launch-node.py b/launch/launch-node.py
index 2e1ae2016c..5d54d5eee8 100755
--- a/launch/launch-node.py
+++ b/launch/launch-node.py
@@ -175,7 +175,7 @@ def bootstrap_server(server, key, name, volume_device, keep,
             jobdir.inventory_root,
             '/opt/system-config/inventory/openstack.yaml',
             '/opt/system-config/inventory/groups.yaml',
-            '/opt/system-config/inventory/emergency.yaml',
+            '/etc/ansible/hosts/emergency.yaml',
         )
         inventory_cmds = [v for e in inventory_list for v in ('-i', e)]
         ansible_cmd = ['ansible-playbook', '--flush-cache' ] + \