add wait flag to flux resume cmd

Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
pull/2450/head
Somtochi Onyekwere 3 years ago
parent b4118b73ed
commit 9c76ba903b

@ -36,6 +36,7 @@ var resumeCmd = &cobra.Command{
type ResumeFlags struct { type ResumeFlags struct {
all bool all bool
wait bool
} }
var resumeArgs ResumeFlags var resumeArgs ResumeFlags
@ -43,6 +44,8 @@ var resumeArgs ResumeFlags
func init() { func init() {
resumeCmd.PersistentFlags().BoolVarP(&resumeArgs.all, "all", "", false, resumeCmd.PersistentFlags().BoolVarP(&resumeArgs.all, "all", "", false,
"resume all resources in that namespace") "resume all resources in that namespace")
resumeCmd.PersistentFlags().BoolVarP(&resumeArgs.wait, "wait", "", false,
"waits for one resource to reconcile before moving to the next one")
rootCmd.AddCommand(resumeCmd) rootCmd.AddCommand(resumeCmd)
} }
@ -107,6 +110,7 @@ func (resume resumeCommand) run(cmd *cobra.Command, args []string) error {
logger.Successf("%s resumed", resume.humanKind) logger.Successf("%s resumed", resume.humanKind)
if resumeArgs.wait || !resumeArgs.all {
namespacedName := types.NamespacedName{ namespacedName := types.NamespacedName{
Name: resume.list.resumeItem(i).asClientObject().GetName(), Name: resume.list.resumeItem(i).asClientObject().GetName(),
Namespace: *kubeconfigArgs.Namespace, Namespace: *kubeconfigArgs.Namespace,
@ -121,6 +125,7 @@ func (resume resumeCommand) run(cmd *cobra.Command, args []string) error {
logger.Successf("%s reconciliation completed", resume.kind) logger.Successf("%s reconciliation completed", resume.kind)
logger.Successf(resume.list.resumeItem(i).successMessage()) logger.Successf(resume.list.resumeItem(i).successMessage())
} }
}
return nil return nil
} }

Loading…
Cancel
Save