Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1922845

Summary: using "blueprints undo" creates a new, empty blueprint
Product: Red Hat Enterprise Linux 8 Reporter: Micah Abbott <miabbott>
Component: osbuild-composerAssignee: Brian Lane <bcl>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: high Docs Contact:
Priority: unspecified    
Version: 8.3CC: atodorov, jrusz, miabbott, obudai
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: osbuild-composer-45-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-10 13:49:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Micah Abbott 2021-01-31 21:47:20 UTC
I have a blueprint with multiple versions saved:

```
# composer-cli blueprints changes my-first-blueprint
my-first-blueprint
    2021-01-31T15:26:42Z  91d7d253badef3830f08c7a9f317a11898d10d49
    Recipe my-first-blueprint, version 0.0.5 saved.

    2021-01-30T15:29:59Z  855754b889614a61b224ef3035287341d50e3936
    Recipe my-first-blueprint, version 0.0.4 saved.

    2021-01-30T15:29:42Z  7728dc2dc46f85478be17beb90e8bd6bc6373eae
    Recipe my-first-blueprint, version 0.0.3 saved.

    2021-01-30T14:57:50Z  84dbb06fb0407b4cfcbf8cd903af2269186c177c
    Recipe my-first-blueprint, version 0.0.3 saved.

    2021-01-30T14:51:25Z  a2568affc9e6038e99e8cc16bde7149508eaa87d
    Recipe my-first-blueprint, version 0.0.2 saved.

    2021-01-30T14:31:45Z  c8dc6292d2c8dca35eec3835afdf45c398eec3a1
    Recipe my-first-blueprint, version 0.0.1 saved.
```

When I try to use the `blueprints undo` function, the blueprint appears unchanged and also creates a new, empty blueprint.

```
# composer-cli blueprints undo my-first-blueprint 84dbb06fb0407b4cfcbf8cd903af2269186c177c

# composer-cli blueprints changes my-first-blueprint
my-first-blueprint
    2021-01-31T15:26:42Z  91d7d253badef3830f08c7a9f317a11898d10d49
    Recipe my-first-blueprint, version 0.0.5 saved.

    2021-01-30T15:29:59Z  855754b889614a61b224ef3035287341d50e3936
    Recipe my-first-blueprint, version 0.0.4 saved.

    2021-01-30T15:29:42Z  7728dc2dc46f85478be17beb90e8bd6bc6373eae
    Recipe my-first-blueprint, version 0.0.3 saved.

    2021-01-30T14:57:50Z  84dbb06fb0407b4cfcbf8cd903af2269186c177c
    Recipe my-first-blueprint, version 0.0.3 saved.

    2021-01-30T14:51:25Z  a2568affc9e6038e99e8cc16bde7149508eaa87d
    Recipe my-first-blueprint, version 0.0.2 saved.

    2021-01-30T14:31:45Z  c8dc6292d2c8dca35eec3835afdf45c398eec3a1
    Recipe my-first-blueprint, version 0.0.1 saved.

# composer-cli blueprints list

my-first-blueprint
second-blueprint

# composer-cli blueprints list | wc -l
3
```

Note, this empty blueprint causes the web UI to stop functioning; it cannot render this magically created blueprint and returns an error "The iterator does not provide a 'throw' method"

Comment 1 Micah Abbott 2021-01-31 21:59:40 UTC
Looks like the change happened according to `state.json`:

```
 jq .changes < state.json 
{
  "": {
    "c59a32fcbab1f9174b208e460aa234b285173ae9": {
      "commit": "c59a32fcbab1f9174b208e460aa234b285173ae9",
      "message": "my-first-blueprint.toml reverted to commit 84dbb06fb0407b4cfcbf8cd903af2269186c177c",
      "revision": null,
      "timestamp": "2021-01-31T15:50:38Z"
    }
  },
  "my-first-blueprint": {
    "7728dc2dc46f85478be17beb90e8bd6bc6373eae": {
      "commit": "7728dc2dc46f85478be17beb90e8bd6bc6373eae",
      "message": "Recipe my-first-blueprint, version 0.0.3 saved.",
      "revision": null,
      "timestamp": "2021-01-30T15:29:42Z"
    },
    "84dbb06fb0407b4cfcbf8cd903af2269186c177c": {
      "commit": "84dbb06fb0407b4cfcbf8cd903af2269186c177c",
      "message": "Recipe my-first-blueprint, version 0.0.3 saved.",
      "revision": null,
      "timestamp": "2021-01-30T14:57:50Z"
    },
    "855754b889614a61b224ef3035287341d50e3936": {
      "commit": "855754b889614a61b224ef3035287341d50e3936",
      "message": "Recipe my-first-blueprint, version 0.0.4 saved.",
      "revision": null,
      "timestamp": "2021-01-30T15:29:59Z"
    },
    "91d7d253badef3830f08c7a9f317a11898d10d49": {
      "commit": "91d7d253badef3830f08c7a9f317a11898d10d49",
      "message": "Recipe my-first-blueprint, version 0.0.5 saved.",
      "revision": null,
      "timestamp": "2021-01-31T15:26:42Z"
    },
    "a2568affc9e6038e99e8cc16bde7149508eaa87d": {
      "commit": "a2568affc9e6038e99e8cc16bde7149508eaa87d",
      "message": "Recipe my-first-blueprint, version 0.0.2 saved.",
      "revision": null,
      "timestamp": "2021-01-30T14:51:25Z"
    },
    "c8dc6292d2c8dca35eec3835afdf45c398eec3a1": {
      "commit": "c8dc6292d2c8dca35eec3835afdf45c398eec3a1",
      "message": "Recipe my-first-blueprint, version 0.0.1 saved.",
      "revision": null,
      "timestamp": "2021-01-30T14:31:45Z"
    }
  },
  "second-blueprint": {
    "1734deb6bdfd539a3d12944b05664e37f0cc79dd": {
      "commit": "1734deb6bdfd539a3d12944b05664e37f0cc79dd",
      "message": "Recipe second-blueprint, version 0.0.0 saved.",
      "revision": null,
      "timestamp": "2021-01-31T15:21:04Z"
    },
    "74209a1c3689fdb703c7cc8acf0176905d35dfdf": {
      "commit": "74209a1c3689fdb703c7cc8acf0176905d35dfdf",
      "message": "Recipe second-blueprint, version 0.0.1 saved.",
      "revision": null,
      "timestamp": "2021-01-31T15:21:42Z"
    },
    "df6bd76085d46cbcc3b4afd18e4ddabd126b0a98": {
      "commit": "df6bd76085d46cbcc3b4afd18e4ddabd126b0a98",
      "message": "Recipe second-blueprint, version 0.0.2 saved.",
      "revision": null,
      "timestamp": "2021-01-31T15:24:36Z"
    },
    "e91332a5cd07c4890b78f7d9e3cd89df82af7430": {
      "commit": "e91332a5cd07c4890b78f7d9e3cd89df82af7430",
      "message": "Recipe second-blueprint, version  saved.",
      "revision": null,
      "timestamp": "2021-01-31T15:18:39Z"
    }
  }
}
```

Comment 2 Micah Abbott 2021-01-31 22:15:34 UTC
I tried to hand edit state.json to remove the offending entry, but wasn't successful in making the web UI functional again.

I ended up nuking `state.json` completely and rebooting the whole system.

Comment 3 Brian Lane 2022-01-21 00:07:37 UTC
PR here - https://github.com/osbuild/osbuild-composer/issues/2207

Comment 7 Alexander Todorov 2022-03-08 11:27:37 UTC
This is covered by unit tests: https://github.com/osbuild/osbuild-composer/runs/5367289789?check_suite_focus=true

Moving to VERIFIED.

Comment 9 errata-xmlrpc 2022-05-10 13:49:28 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 (osbuild-composer bug fix and enhancement update), 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-2022:1841