Skip to content

Commit

Permalink
Fix upgrade for single hosts
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
  • Loading branch information
alexellis committed Nov 1, 2023
1 parent 46843cd commit 19d1a3e
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions cmd/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ func runUpgradeE(cmd *cobra.Command, args []string) error {
return fmt.Errorf("--all or --host is required")
}

// if len(owner) == 0 {
// return fmt.Errorf("owner is required")
// }
if !allHosts && len(owner) == 0 {
return fmt.Errorf("owner is required")
}

if len(pat) == 0 {
return fmt.Errorf("pat is required")
Expand All @@ -98,23 +98,21 @@ func runUpgradeE(cmd *cobra.Command, args []string) error {
if err := json.Unmarshal([]byte(hosts), &hostsList); err != nil {
return err
}
reachableHosts := []Host{}

for _, h := range hostsList {
reachableHosts = append(reachableHosts, h)
}
if len(hostsList) == 0 {

if len(reachableHosts) == 0 {
return fmt.Errorf("no reachable hosts found")
return fmt.Errorf("no hosts found")
}
upgradeHosts = reachableHosts

upgradeHosts = hostsList
} else {

// AE: TODO call ListRunners to determine the values for: Reachable and Status.
upgradeHosts = []Host{
{
Name: host,
Customer: owner,
Reachable: true,
Status: "running",
},
}
}
Expand Down

0 comments on commit 19d1a3e

Please sign in to comment.