From 9587f3b0c96d21d326516f7101cbba09aaa630a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Peliz=C3=A4us?= Date: Tue, 22 Oct 2024 17:05:41 +0200 Subject: [PATCH 1/4] cmd/microcloud/main_init: Remove redundant flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The --wipe, --encrypt and --address flags made sense together with --auto. As the --auto option got removed those flags have to be removed too. Signed-off-by: Julian Pelizäus --- cmd/microcloud/main_init.go | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/cmd/microcloud/main_init.go b/cmd/microcloud/main_init.go index 713d7a28..9155e418 100644 --- a/cmd/microcloud/main_init.go +++ b/cmd/microcloud/main_init.go @@ -126,10 +126,7 @@ type initConfig struct { type cmdInit struct { common *CmdControl - flagSessionTimeout int64 - flagWipeAllDisks bool - flagEncryptAllDisks bool - flagAddress string + flagSessionTimeout int64 } func (c *cmdInit) Command() *cobra.Command { @@ -140,9 +137,6 @@ func (c *cmdInit) Command() *cobra.Command { RunE: c.Run, } - cmd.Flags().BoolVar(&c.flagWipeAllDisks, "wipe", false, "Wipe disks to add to MicroCeph") - cmd.Flags().BoolVar(&c.flagEncryptAllDisks, "encrypt", false, "Encrypt disks to add to MicroCeph") - cmd.Flags().StringVar(&c.flagAddress, "address", "", "Address to use for MicroCloud") cmd.Flags().Int64Var(&c.flagSessionTimeout, "session-timeout", 0, "Amount of seconds to wait for the trust establishment session. Defaults: 60m") return cmd @@ -154,15 +148,12 @@ func (c *cmdInit) Run(cmd *cobra.Command, args []string) error { } cfg := initConfig{ - bootstrap: true, - setupMany: true, - address: c.flagAddress, - wipeAllDisks: c.flagWipeAllDisks, - encryptAllDisks: c.flagEncryptAllDisks, - common: c.common, - asker: &c.common.asker, - systems: map[string]InitSystem{}, - state: map[string]service.SystemInformation{}, + bootstrap: true, + setupMany: true, + common: c.common, + asker: &c.common.asker, + systems: map[string]InitSystem{}, + state: map[string]service.SystemInformation{}, } cfg.sessionTimeout = DefaultSessionTimeout From b571b57c67fdb390499f470c744c525461cb686a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Peliz=C3=A4us?= Date: Tue, 22 Oct 2024 17:06:37 +0200 Subject: [PATCH 2/4] cmd/microcloud/ad: Remove redundant flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The --wipe flag made sense together with --auto. As the --auto option got removed this flag has to be removed too. Signed-off-by: Julian Pelizäus --- cmd/microcloud/add.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/cmd/microcloud/add.go b/cmd/microcloud/add.go index 5003e21c..f19f9568 100644 --- a/cmd/microcloud/add.go +++ b/cmd/microcloud/add.go @@ -18,7 +18,6 @@ import ( type cmdAdd struct { common *CmdControl - flagWipe bool flagSessionTimeout int64 } @@ -29,7 +28,6 @@ func (c *cmdAdd) Command() *cobra.Command { RunE: c.Run, } - cmd.Flags().BoolVar(&c.flagWipe, "wipe", false, "Wipe disks to add to MicroCeph") cmd.Flags().Int64Var(&c.flagSessionTimeout, "session-timeout", 0, "Amount of seconds to wait for the trust establishment session. Defaults: 60m") return cmd @@ -41,13 +39,12 @@ func (c *cmdAdd) Run(cmd *cobra.Command, args []string) error { } cfg := initConfig{ - bootstrap: false, - setupMany: true, - wipeAllDisks: c.flagWipe, - common: c.common, - asker: &c.common.asker, - systems: map[string]InitSystem{}, - state: map[string]service.SystemInformation{}, + bootstrap: false, + setupMany: true, + common: c.common, + asker: &c.common.asker, + systems: map[string]InitSystem{}, + state: map[string]service.SystemInformation{}, } cfg.sessionTimeout = DefaultSessionTimeout From 346d17928e4a1a60f490ff62572d05e51f7fd998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Peliz=C3=A4us?= Date: Tue, 22 Oct 2024 22:31:29 +0200 Subject: [PATCH 3/4] cmd/microcloud: Remove wipeAllDisks field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julian Pelizäus --- cmd/microcloud/ask.go | 14 +++++--------- cmd/microcloud/main_init.go | 3 --- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/cmd/microcloud/ask.go b/cmd/microcloud/ask.go index 2c9f2d42..c1984684 100644 --- a/cmd/microcloud/ask.go +++ b/cmd/microcloud/ask.go @@ -346,7 +346,7 @@ func (c *initConfig) askLocalPool(sh *service.Handler) error { return fmt.Errorf("Failed to add local storage pool: Some peers don't have an available disk") } - if !c.wipeAllDisks && wipeable { + if wipeable { fmt.Println("Select which disks to wipe:") err := table.Render(selectedRows) if err != nil { @@ -377,7 +377,7 @@ func (c *initConfig) askLocalPool(sh *service.Handler) error { return nil } - if c.wipeAllDisks && wipeable { + if wipeable { toWipe = selectedDisks } @@ -638,11 +638,6 @@ func (c *initConfig) askRemotePool(sh *service.Handler) error { sort.Sort(cli.SortColumnsNaturally(data)) table := NewSelectableTable(header, data) - selected := table.rows - var toWipe []string - if c.wipeAllDisks { - toWipe = selected - } if len(table.rows) == 0 { return nil @@ -654,12 +649,13 @@ func (c *initConfig) askRemotePool(sh *service.Handler) error { return err } - selected, err = table.GetSelections() + selected, err := table.GetSelections() if err != nil { return fmt.Errorf("Invalid disk configuration: %w", err) } - if len(selected) > 0 && !c.wipeAllDisks { + var toWipe []string + if len(selected) > 0 { fmt.Println("Select which disks to wipe:") err := table.Render(selected) if err != nil { diff --git a/cmd/microcloud/main_init.go b/cmd/microcloud/main_init.go index 9155e418..4a2caef0 100644 --- a/cmd/microcloud/main_init.go +++ b/cmd/microcloud/main_init.go @@ -103,9 +103,6 @@ type initConfig struct { // sessionTimeout is the duration to wait for the trust establishment session to complete. sessionTimeout time.Duration - // wipeAllDisks indicates whether all disks should be wiped, or if the user should be prompted. - wipeAllDisks bool - // encryptAllDisks indicates whether all disks should be encrypted, or if the user should be prompted. encryptAllDisks bool From 058c059320ed62c14818710e825fab1ca9297a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Peliz=C3=A4us?= Date: Tue, 22 Oct 2024 22:33:13 +0200 Subject: [PATCH 4/4] cmd/microcloud: Remove encryptAllDisks field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julian Pelizäus --- cmd/microcloud/ask.go | 4 ++-- cmd/microcloud/main_init.go | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/cmd/microcloud/ask.go b/cmd/microcloud/ask.go index c1984684..41f7c7b9 100644 --- a/cmd/microcloud/ask.go +++ b/cmd/microcloud/ask.go @@ -724,8 +724,8 @@ func (c *initConfig) askRemotePool(sh *service.Handler) error { } } - encryptDisks := c.encryptAllDisks - if !c.encryptAllDisks && len(selectedDisks) > 0 { + encryptDisks := false + if len(selectedDisks) > 0 { var err error encryptDisks, err = c.asker.AskBool("Do you want to encrypt the selected disks? (yes/no) [default=no]: ", "no") if err != nil { diff --git a/cmd/microcloud/main_init.go b/cmd/microcloud/main_init.go index 4a2caef0..e5aca7f0 100644 --- a/cmd/microcloud/main_init.go +++ b/cmd/microcloud/main_init.go @@ -103,9 +103,6 @@ type initConfig struct { // sessionTimeout is the duration to wait for the trust establishment session to complete. sessionTimeout time.Duration - // encryptAllDisks indicates whether all disks should be encrypted, or if the user should be prompted. - encryptAllDisks bool - // lookupIface is the interface used for multicast lookup. lookupIface *net.Interface