Bug 1868439 - openstack UPI: scripts fail modifying the masters Ignition file
Summary: openstack UPI: scripts fail modifying the masters Ignition file
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Installer
Version: 4.6
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.6.0
Assignee: Pierre Prinetti
QA Contact: weiwei jiang
URL:
Whiteboard:
: 1876835 1876843 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-12 17:13 UTC by Pierre Prinetti
Modified: 2020-10-27 16:28 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: A change in how Ignition files are generated in 4.6 removed an empty property from Ignition files. Consequence: A Python 'KeyError' when running the steaps documented in UPI Fix: The documentation is updated to create the missing key. Result: The error is not happening any more.
Clone Of:
Environment:
Last Closed: 2020-10-27 16:28:06 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift installer pull 4047 0 None closed Bug 1868439: openstack upi: fix Ignition key error 2020-10-07 16:24:41 UTC
Github openshift installer pull 4058 0 None closed Bug 1868439: openstack UPI: Fix Ignition v3 2020-10-07 16:24:49 UTC
Github openshift installer pull 4135 0 None closed Bug 1868439: openstack UPI: Fix Ingition key error 2020-10-07 16:24:40 UTC
Github openshift installer pull 4140 0 None closed Bug 1868439: openstack UPI: Fix JSON syntax 2020-10-07 16:24:40 UTC
Github openshift openshift-docs pull 25605 0 None open [OSP] Update Ignition files script - BZ1868439 2020-10-07 16:24:40 UTC
Github openshift release pull 11678 0 None closed Bug 1868439: e2e-openstack-upi: Ignition files to v3 spec 2020-10-07 16:24:40 UTC
Red Hat Knowledge Base (Solution) 5440641 0 None None None 2020-09-28 21:38:54 UTC
Red Hat Product Errata RHBA-2020:4196 0 None None None 2020-10-27 16:28:24 UTC

Description Pierre Prinetti 2020-08-12 17:13:40 UTC
Description of problem:

While applying this script:

```
python -c "import base64, json, sys;
    python -c "import base64, json, sys;
ignition = json.load(sys.stdin);
ignition = json.load(sys.stdin);
files = ignition['storage'].get('files', []);
storage = ignition.get('storage', {});
files.append({'path': '/etc/hostname', 'mode': 420, 'contents': {'source': 'data:text/plain;charset=utf-8;base64,' + base64.standard_b64encode(b'$MASTER_HOSTNAME').decode().strip()}});
files = storage.get('files', []);
ignition['storage']['files'] = files;
files.append({'path': '/etc/hostname', 'mode': 420, 'contents': {'source': 'data:text/plain;charset=utf-8;base64,' + base64.standard_b64encode(b'$MASTER_HOSTNAME').decode().strip(), 'verification': {}}, 'filesystem': 'root'});
storage['files'] = files;
ignition['storage'] = storage
json.dump(ignition, sys.stdout)" <master.ign
```

Python fails with:

```
Traceback (most recent call last):
  File "<string>", line 3, in <module>
KeyError: 'storage' 
```

The 'storage' property does not seem to be present any more in the master ignition file.

Comment 2 Pierre Prinetti 2020-09-08 15:05:25 UTC
*** Bug 1876835 has been marked as a duplicate of this bug. ***

Comment 5 weiwei jiang 2020-09-09 10:08:46 UTC
Verified

$ python -c "import base64, json, sys;                                                                                                                                                                                       
ignition = json.load(sys.stdin);
storage = ignition.get('storage', {});
files = storage.get('files', []);
files.append({'path': '/etc/hostname', 'mode': 420, 'contents': {'source': 'data:text/plain;charset=utf-8;base64,' + base64.standard_b64encode(b'$MASTER_HOSTNAME').decode().strip()}});
storage['files'] = files;
ignition['storage'] = storage
json.dump(ignition, sys.stdout)" <master.ign
{"ignition": {"config": {"merge": [{"source": "https://192.168.0.5:22623/config/master"}]}, "security": {"tls": {"certificateAuthorities": [{"source": "data:text/plain;charset=utf-8;base64,xxxxxxxxx"}]}}, "version": "3.1.0"}, "storage": {"files": [{"path": "/etc/hostname", "mode": 420, "contents": {"source": "data:text/plain;charset=utf-8;base64,"}}]}}

Comment 6 Max Bridges 2020-09-18 19:05:48 UTC
@wjiang Can you verify this downstream, too?

https://github.com/openshift/openshift-docs/pull/25605

Comment 7 Max Bridges 2020-09-24 12:20:34 UTC
*** Bug 1876843 has been marked as a duplicate of this bug. ***

Comment 8 Max Bridges 2020-10-07 16:25:19 UTC
Moving to QE again, as this needs to be verified in the downstream docs, too. 

https://github.com/openshift/openshift-docs/pull/25605

Comment 9 weiwei jiang 2020-10-09 02:52:53 UTC
The Doc look good from the QE perspective, so move to verified.

Comment 10 Max Bridges 2020-10-09 13:44:10 UTC
Change merged into 4.6 release + master branches.

Comment 12 errata-xmlrpc 2020-10-27 16:28:06 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Container Platform 4.6 GA Images), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4196


Note You need to log in before you can comment on or make changes to this bug.