Skip to content

Commit

Permalink
FS-1316; Add preload for latency fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeschuurmans committed Jun 24, 2024
1 parent 597c25a commit ff58d92
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func AttributeFromLabels(ns string, labels map[string]string) (*fleetdbapi.Attri
}, nil
}

// AttributeByNamespace returns the serverservice attribute in the slice that matches the namespace
// AttributeByNamespace returns the fleetdb attribute in the slice that matches the namespace
//
// TODO: move into common library and share with Alloy
func AttributeByNamespace(ns string, attributes []fleetdbapi.Attributes) *fleetdbapi.Attributes {
Expand Down
5 changes: 5 additions & 0 deletions cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var (
MacBMCFlag = &flagDetails{name: "bmc-mac"}
OutputFlag = &flagDetails{name: "output", short: "o"}
ForceFlag = &flagDetails{name: "force"}
PreLoadFlag = &flagDetails{name: "preload"}
DryRunFlag = &flagDetails{name: "dry-run"}
SkipBmcResetFlag = &flagDetails{name: "skip-bmc-reset"}
PowerOffRequiredFlag = &flagDetails{name: "power-off-required"}
Expand Down Expand Up @@ -226,6 +227,10 @@ func AddOutputFlag(cmd *cobra.Command, ptr *string) {
cmd.PersistentFlags().VarP(outputFlag, OutputFlag.name, OutputFlag.short, "{json|text}")
}

func AddPreLoadFlag(cmd *cobra.Command, ptr *bool) {
cmd.PersistentFlags().BoolVar(ptr, PreLoadFlag.name, false, "set to true in order to also load sub items. Example: Listing servers with preload will also load their components, attributes, and versioned attributes")
}

func AddForceFlag(cmd *cobra.Command, ptr *bool, usage string) {
cmd.PersistentFlags().BoolVar(ptr, ForceFlag.name, false, usage)
}
Expand Down
4 changes: 3 additions & 1 deletion cmd/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
)

var (
output string
output string
preload bool
)

var list = &cobra.Command{
Expand All @@ -26,4 +27,5 @@ func init() {
list.AddCommand(cmdListServer)

cmd.AddOutputFlag(list, &output)
cmd.AddPreLoadFlag(list, &preload)
}
3 changes: 2 additions & 1 deletion cmd/list/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ var cmdListServer = &cobra.Command{
PaginationParams{
Limit: flagsListServer.limit,
Page: flagsListServer.page,
Preload: false,
Preload: preload,
OrderBy: "",
},
}

Expand Down
1 change: 1 addition & 0 deletions docs/mctl_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ mctl list [flags]
```
-h, --help help for list
-o, --output outputType {json|text} (default json)
--preload set to true in order to also load sub items. Example: Listing servers with preload will also load their components, attributes, and versioned attributes
```

### Options inherited from parent commands
Expand Down
1 change: 1 addition & 0 deletions docs/mctl_list_component.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ mctl list component --slug SLUG [flags]
```
-c, --config string config file (default is $XDG_CONFIG_HOME/mctl/config.yml)
-o, --output outputType {json|text} (default json)
--preload set to true in order to also load sub items. Example: Listing servers with preload will also load their components, attributes, and versioned attributes
--reauth re-authenticate with oauth services
```

Expand Down
1 change: 1 addition & 0 deletions docs/mctl_list_firmware-set.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ mctl list firmware-set [flags]
```
-c, --config string config file (default is $XDG_CONFIG_HOME/mctl/config.yml)
-o, --output outputType {json|text} (default json)
--preload set to true in order to also load sub items. Example: Listing servers with preload will also load their components, attributes, and versioned attributes
--reauth re-authenticate with oauth services
```

Expand Down
1 change: 1 addition & 0 deletions docs/mctl_list_firmware.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ mctl list firmware [flags]
```
-c, --config string config file (default is $XDG_CONFIG_HOME/mctl/config.yml)
-o, --output outputType {json|text} (default json)
--preload set to true in order to also load sub items. Example: Listing servers with preload will also load their components, attributes, and versioned attributes
--reauth re-authenticate with oauth services
```

Expand Down
1 change: 1 addition & 0 deletions docs/mctl_list_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ mctl list server [flags]
```
-c, --config string config file (default is $XDG_CONFIG_HOME/mctl/config.yml)
-o, --output outputType {json|text} (default json)
--preload set to true in order to also load sub items. Example: Listing servers with preload will also load their components, attributes, and versioned attributes
--reauth re-authenticate with oauth services
```

Expand Down

0 comments on commit ff58d92

Please sign in to comment.