From 3599e64205d3dfdcdc8d867025909230181cabbd Mon Sep 17 00:00:00 2001 From: Rohith Date: Fri, 4 Aug 2017 11:25:23 +0100 Subject: [PATCH] - fixing up the flag name from --create to --force to make it align to the kubectl syntax --- cmd/kops/replace.go | 14 +++++++------- docs/cli/kops_replace.md | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/kops/replace.go b/cmd/kops/replace.go index 8768c61388931..2cadba900ecc1 100644 --- a/cmd/kops/replace.go +++ b/cmd/kops/replace.go @@ -42,8 +42,8 @@ var ( # Replace a cluster specification using a file kops replace -f my-cluster.yaml - # Note, if the resource does not exist the command will error, use --create to provision resource - kops replace -f my-cluster.yaml --create + # Note, if the resource does not exist the command will error, use --force to provision resource + kops replace -f my-cluster.yaml --force `)) replaceShort = i18n.T(`Replace cluster resources.`) @@ -54,7 +54,7 @@ type replaceOptions struct { // a list of files containing resources resource.FilenameOptions // create any resources not found - we limit to instance groups only for now - createNotFound bool + force bool } // NewCmdReplace returns a new replace command @@ -76,7 +76,7 @@ func NewCmdReplace(f *util.Factory, out io.Writer) *cobra.Command { }, } cmd.Flags().StringSliceVarP(&options.Filenames, "filename", "f", options.Filenames, "A list of one or more files separated by a comma.") - cmd.Flags().BoolVarP(&options.createNotFound, "create", "c", false, "Create any resources which are not found (defaults only to instancegroups for now)") + cmd.Flags().BoolVarP(&options.force, "force", "", false, "Force any changes, which will also create any non-existing respurce (defaults to instancegroups only)") cmd.MarkFlagRequired("filename") return cmd @@ -132,7 +132,7 @@ func RunReplace(f *util.Factory, cmd *cobra.Command, out io.Writer, c *replaceOp if cluster == nil { return fmt.Errorf("cluster %q not found", clusterName) } - // @check if the instancegroup exists already + // check if the instancegroup exists already igName := v.ObjectMeta.Name ig, err := clientset.InstanceGroupsFor(cluster).Get(igName, metav1.GetOptions{}) if err != nil { @@ -140,8 +140,8 @@ func RunReplace(f *util.Factory, cmd *cobra.Command, out io.Writer, c *replaceOp } switch ig { case nil: - if !c.createNotFound { - return fmt.Errorf("instanceGroup: %v does not exist (try adding --create flag)", igName) + if !c.force { + return fmt.Errorf("instanceGroup: %v does not exist (try adding --force flag)", igName) } glog.Infof("instanceGroup: %v was not found, creating resource now", igName) _, err = clientset.InstanceGroupsFor(cluster).Create(v) diff --git a/docs/cli/kops_replace.md b/docs/cli/kops_replace.md index 6455cb58639a0..074d2267a0a5e 100644 --- a/docs/cli/kops_replace.md +++ b/docs/cli/kops_replace.md @@ -20,15 +20,15 @@ kops replace -f FILENAME # Replace a cluster specification using a file kops replace -f my-cluster.yaml - # Note, if the resource does not exist the command will error, use --create to provision resource - kops replace -f my-cluster.yaml --create + # Note, if the resource does not exist the command will error, use --force to provision resource + kops replace -f my-cluster.yaml --force ``` ### Options ``` - -c, --create Create any resources which are not found (defaults only to instancegroups for now) -f, --filename stringSlice A list of one or more files separated by a comma. + --force Force any changes, which will also create any non-existing respurce (defaults to instancegroups only) ``` ### Options inherited from parent commands