Record kubectl commands

This commit is contained in:
Janet Kuo
2016-01-22 10:33:23 -08:00
parent 210bac10c9
commit 5088d0e147
38 changed files with 277 additions and 11 deletions

View File

@@ -97,6 +97,7 @@ func NewCmdLabel(f *cmdutil.Factory, out io.Writer) *cobra.Command {
usage := "Filename, directory, or URL to a file identifying the resource to update the labels"
kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage)
cmd.Flags().Bool("dry-run", false, "If true, only print the object that would be sent, without sending it.")
cmdutil.AddRecordFlag(cmd)
return cmd
}
@@ -252,6 +253,11 @@ func RunLabel(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri
if err := labelFunc(obj, overwrite, resourceVersion, lbls, remove); err != nil {
return err
}
if cmdutil.ShouldRecord(cmd, info) {
if err := cmdutil.RecordChangeCause(obj, f.Command()); err != nil {
return err
}
}
newData, err := json.Marshal(obj)
if err != nil {
return err