Bug 1669995 - [DOCS] openshift-install destroy cluster command, returns: "FATAL Failed while preparing to destroy cluster: open metadata.json: no such file or directory"
Summary: [DOCS] openshift-install destroy cluster command, returns: "FATAL Failed whil...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Documentation
Version: 4.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
: 4.1.0
Assignee: Kathryn Alexander
QA Contact: sheng.lao
Vikram Goyal
URL:
Whiteboard:
Depends On:
Blocks: 1664187
TreeView+ depends on / blocked
 
Reported: 2019-01-28 10:20 UTC by Johnray Fuller
Modified: 2023-09-14 04:45 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-14 20:24:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3826921 0 Install None How to delete an OpenShift 4 cluster without a metadata.json file 2019-02-18 19:18:27 UTC
Red Hat Knowledge Base (Solution) 3841621 0 None None None 2019-01-28 10:25:44 UTC

Description Johnray Fuller 2019-01-28 10:20:56 UTC
Description of problem:

The "openshift-install destroy cluster" command, returns the following error:

$ openshift-install destroy cluster
FATAL Failed while preparing to destroy cluster: open metadata.json: no such file or directory 

When running the openshift-install command, it places a number of files and directorys in the current working directory. The "openshift-install destroy cluster" requires the presence of the metadata.json created by the "openshift-install create cluster" command.

This error can suggest the user should take note of the current working directory where the installer was run and be sure to run the "openshift-install destroy cluster" command from the same directory where you ran the "openshift-install create cluster" command.

Version-Release number of the following components:
$ openshift-install version
openshift-install v0.11.0

How reproducible:
Every time.

Steps to Reproduce:
1. openshift-install create cluster
2. cd ~/another_dir
3. openshift-install destroy cluster

Actual results:

FATAL Failed while preparing to destroy cluster: open metadata.json: no such file or directory 



Expected results:

An error return that suggests the user should take note of the current working directory where the installer was run and be sure to run the "openshift-install destroy cluster" command from the same directory where you ran the "openshift-install create cluster" command.


Additional info:

Knowledgebase created.

Comment 1 W. Trevor King 2019-01-28 20:33:05 UTC
> This error can suggest the user should take note of the current working directory where the installer was run and be sure to run the "openshift-install destroy cluster" command from the same directory where you ran the "openshift-install create cluster" command.

This is true of all openshift-install calls which are intended to affect a given cluster, it's not specific to 'destroy cluster' or this error.  I'm not sure how we would reliably distinguish "ran on the wrong directory" in general for error messages, but I have no problem with adding an entry to the troubleshooting docs [1] with a section for "Are you sure you're using the right asset directory for your cluster?".  Would that be sufficient to close this issue?

[1]: ttps://github.com/openshift/installer/blob/master/docs/user/troubleshooting.md

Comment 2 Johnray Fuller 2019-02-08 05:01:27 UTC
Hello,

Agree that an entry should be added to troubleshooting.md as this is straightforward.

Interestingly, today, I moved to the 0.12.0 version of the installer and this installation failed (there was a resource issue in my AWS account and another error related to profiles I have not seen before). But not metadata.json file was created at all by the create command. So in this case, I have a bunch of resources created in AWS and a tfstate file, but no metadata.json. So I can't "destroy" the AWS items through the installer. Is that a separate BZ from this in your opinion?

Comment 3 W. Trevor King 2019-02-08 06:32:28 UTC
> But not metadata.json file was created at all by the create command.

That's bug 1673185.

Comment 4 Eric Rich 2019-02-18 19:20:24 UTC
You can also create the metadata.json file your self by following: https://access.redhat.com/solutions/3826921

Comment 5 W. Trevor King 2019-02-27 05:54:08 UTC
So with bug 1673185 fixed in v0.13.0, what's left here?  That leaves just the "don't forget about the asset directory" docs floated in comment 1 for this issue.

Comment 6 W. Trevor King 2019-02-27 05:55:58 UTC
Sorry, I wrote the previous comment in two stages, and forgot to read it over completely before posting :p.  I'm convinced that the docs are the only outstanding issue here, so no needinfo.  But feel free to weigh in if you think I'm missing something :).

Comment 7 Scott Dodson 2019-04-04 14:47:53 UTC
We just need to make sure that the documentation makes it clear that files are created in $(pwd) or --dir and that those files should be preserved for future operations including destroying the cluster. Moving to docs.

I'm not sure whether I'd call this a 4.1 blocker or not.

Comment 8 Kathryn Alexander 2019-04-08 12:50:04 UTC
The docs already say to specify the installation directory that contains your files in the destroy command: https://docs.openshift.com/container-platform/4.0/installing/installing_aws/uninstalling-cluster-aws.html

The installation instructions already tell you to use --dir= to specify a directory (https://docs.openshift.com/container-platform/4.0/installing/installing_aws/installing-aws-default.html#launching-installer-installing-aws-default), and I'm adding a note to remind users to not delete the installer or the folder of data when the bug about regenerating the metadata.json file merges (https://bugzilla.redhat.com/show_bug.cgi?id=1683019).

@Vikram, is this a dupe or NOTABUG?

Comment 9 Eric Rich 2019-04-08 13:18:10 UTC
The way the docs currently read, they don't deal with this situation. We should document what the installer does (when it uninstalls), in that it reads the metadata.json file, and works to remove a cluster, without that file (pointing to the right cluster) the delete process will fail (thus the source of this bug).

Comment 10 Kathryn Alexander 2019-04-22 15:28:25 UTC
OK! I'm adding a note here: https://github.com/openshift/openshift-docs/pull/14554
I'll make sure that this intention is preserved whenever https://bugzilla.redhat.com/show_bug.cgi?id=1683019 is resolved.

Johnray, will you PTAL?

Comment 11 sheng.lao 2019-05-09 10:24:49 UTC
Looks good to me, It, the new version doc, is clear to express the facts:
1. user needs to preserve the files that the installation program creates.
2. installer uses the metadata.json to destroy the cluster.

If no more suggestion,I will move this bug to status 'verified'

Comment 12 Kathryn Alexander 2019-05-09 14:31:24 UTC
Thank you Sheng Lao! Please move the bug to verified whenever you're ready.

Comment 13 Kathryn Alexander 2019-05-10 15:29:44 UTC
I've merged the PR and am waiting for it to go live.

Comment 15 Red Hat Bugzilla 2023-09-14 04:45:45 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days


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