diff --git a/cmd/openshift-install/main.go b/cmd/openshift-install/main.go index 778cb14985e..ff158596183 100644 --- a/cmd/openshift-install/main.go +++ b/cmd/openshift-install/main.go @@ -49,6 +49,7 @@ func installerMain() { newWaitForCmd(), newGatherCmd(), newVersionCmd(), + newRhcosMetadataCmd(), newGraphCmd(), newCompletionCmd(), } { diff --git a/cmd/openshift-install/rhcos-metadata.go b/cmd/openshift-install/rhcos-metadata.go new file mode 100644 index 00000000000..967ff8259b3 --- /dev/null +++ b/cmd/openshift-install/rhcos-metadata.go @@ -0,0 +1,35 @@ +package main + +import ( + "io" + "os" + + "github.com/spf13/cobra" + + "github.com/openshift/installer/data" +) + +func newRhcosMetadataCmd() *cobra.Command { + return &cobra.Command{ + Use: "rhcos-metadata", + Short: "Output Red Hat Enterprise Linux CoreOS metaadata", + Long: "", + Args: cobra.ExactArgs(0), + RunE: runRhcosMetadata, + } +} + +// runRhcosMetadata simply dumps the embedded RHCOS metadata to +// stdout. See also https://github.com/openshift/installer/issues/1399 +func runRhcosMetadata(cmd *cobra.Command, args []string) error { + file, err := data.Assets.Open("rhcos.json") + if err != nil { + return err + } + defer file.Close() + _, err = io.Copy(os.Stdout, file) + if err != nil { + return err + } + return nil +}