Skip to content

Commit d4154c3

Browse files
author
kamil cybulski
committed
fix(server): error text for setting memory and cores with omitted plan
1 parent 7c11826 commit d4154c3

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

internal/commands/server/create.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,23 +266,25 @@ func (s *createCommand) InitCommand() {
266266
fs.StringVar(&s.params.TimeZone, "time-zone", def.TimeZone, "Time zone to set the RTC to.")
267267
fs.StringVar(&s.params.VideoModel, "video-model", def.VideoModel, "Video interface model of the server. Available: vga, cirrus")
268268
config.AddEnableOrDisableFlag(fs, &s.firewall, def.firewall, "firewall", "firewall")
269-
// fs.BoolVar(&s.params.firewall, "firewall", def.firewall, "Enables the firewall. You can manage firewall rules with the firewall command.")
269+
// ----------- fs.BoolVar(&s.params.firewall, "firewall", def.firewall, "Enables the firewall. You can manage firewall rules with the firewall command.")
270270
config.AddEnableOrDisableFlag(fs, &s.metadata, def.metadata, "metadata", "metadata service")
271-
// fs.BoolVar(&s.params.metadata, "metadata", def.metadata, "Enable metadata service.")
271+
// ----------- fs.BoolVar(&s.params.metadata, "metadata", def.metadata, "Enable metadata service.")
272272
fs.StringArrayVar(&s.params.storages, "storage", def.storages, "A storage connected to the server, multiple can be declared.\nUsage: --storage action=attach,storage=01000000-0000-4000-8000-000020010301,type=cdrom")
273273
fs.StringArrayVar(&s.params.networks, "network", def.networks, "A network interface for the server, multiple can be declared.\nUsage: --network family=IPv4,type=public\n\n--network type=private,network=037a530b-533e-4cef-b6ad-6af8094bb2bc,ip-address=10.0.0.1")
274274
config.AddToggleFlag(fs, &s.createPassword, "create-password", def.createPassword, "Create an admin password.")
275275
fs.StringVar(&s.params.username, "username", def.username, "Admin account username.")
276276
fs.StringSliceVar(&s.params.sshKeys, "ssh-keys", def.sshKeys, "Add one or more SSH keys to the admin account. Accepted values are SSH public keys or filenames from where to read the keys.")
277277
config.AddEnableOrDisableFlag(fs, &s.remoteAccess, def.remoteAccess, "remote-access", "remote access")
278-
// fs.BoolVar(&s.params.remoteAccess, "remote-access-enabled", def.remoteAccess, "Enables or disables the remote access.")
278+
// ----------- fs.BoolVar(&s.params.remoteAccess, "remote-access-enabled", def.remoteAccess, "Enables or disables the remote access.")
279279
fs.StringVar(&s.params.RemoteAccessType, "remote-access-type", def.RemoteAccessType, "Set a remote access type. Available: vnc, spice")
280280
fs.StringVar(&s.params.RemoteAccessPassword, "remote-access-password", def.RemoteAccessPassword, "Defines the remote access password.")
281281
s.AddFlags(fs)
282282
}
283283

284284
// ExecuteWithoutArguments implements commands.NoArgumentCommand
285285
func (s *createCommand) ExecuteWithoutArguments(exec commands.Executor) (output.Output, error) {
286+
fmt.Printf("\033[31m Plan: %s | Cores: %d | Mem: %d\033[0m", s.params.Plan, s.params.CoreNumber, s.params.MemoryAmount)
287+
286288
if s.params.Hostname == "" || s.params.Zone == "" {
287289
return nil, fmt.Errorf("hostname, zone and some password delivery method are required")
288290
}
@@ -304,10 +306,8 @@ func (s *createCommand) ExecuteWithoutArguments(exec commands.Executor) (output.
304306
}
305307

306308
if s.params.Plan != "" && s.params.Plan != customPlan {
307-
return nil, fmt.Errorf("--plan needs to be 'custom' or omitted when --cores and --memory are specified")
309+
return nil, fmt.Errorf("--plan needs to be 'custom' when --cores and --memory are specified")
308310
}
309-
310-
s.params.Plan = customPlan // Valid for all custom plans.
311311
}
312312

313313
serverSvc := exec.Server()

0 commit comments

Comments
 (0)