Skip to content

Commit

Permalink
Separated auth from util and fixed help strings
Browse files Browse the repository at this point in the history
  • Loading branch information
davidallendj committed Aug 12, 2024
1 parent dce823c commit 3287d76
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
7 changes: 3 additions & 4 deletions cmd/crawl.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ import (
var crawlCmd = &cobra.Command{
Use: "crawl [uri]",
Short: "Crawl a single BMC for inventory information",
Long: "Crawl a single BMC for inventory information. This command does NOT store information" +
"store information about the scan into cache after completion. To do so, use the 'collect'" +
"command instead\n" +
"\n" +
Long: "Crawl a single BMC for inventory information. This command does NOT store information\n" +
"store information about the scan into cache after completion. To do so, use the 'collect'\n" +
"command instead\n\n" +
"Examples:\n" +
" magellan crawl https://bmc.example.com\n" +
" magellan crawl https://bmc.example.com -i -u username -p password",
Expand Down
4 changes: 2 additions & 2 deletions cmd/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os"

magellan "github.com/OpenCHAMI/magellan/internal"
"github.com/OpenCHAMI/magellan/internal/util"
"github.com/OpenCHAMI/magellan/pkg/auth"
"github.com/lestrrat-go/jwx/jwt"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
Expand All @@ -30,7 +30,7 @@ var loginCmd = &cobra.Command{
// check if we have a valid JWT before starting login
if !forceLogin {
// try getting the access token from env var
testToken, err := util.LoadAccessToken(tokenPath)
testToken, err := auth.LoadAccessToken(tokenPath)
if err != nil {
log.Error().Err(err).Msgf("failed to load access token")
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

magellan "github.com/OpenCHAMI/magellan/internal"
"github.com/OpenCHAMI/magellan/internal/cache/sqlite"
"github.com/OpenCHAMI/magellan/internal/util"
"github.com/OpenCHAMI/magellan/pkg/client"
"github.com/rs/zerolog/log"

"github.com/cznic/mathutil"
Expand Down Expand Up @@ -40,7 +40,7 @@ var scanCmd = &cobra.Command{
"by using the '--subnet' flag and providing an IP address on the subnet as well as a CIDR. If no CIDR is\n" +
"provided, then the subnet mask specified with the '--subnet-mask' flag will be used instead (will use\n" +
"default mask if not set).\n\n" +
"Similarly, any host provided with no port with use either the ports specified\n" +
"Similarly, any host provided with no port will use either the ports specified\n" +
"with `--port` or the default port used with each specified protocol. The default protocol is 'tcp' unless\n" +
"specified. The `--scheme` flag works similarly and the default value is 'https' in the host URL or with the\n" +
"'--protocol' flag.\n\n" +
Expand Down Expand Up @@ -72,8 +72,8 @@ var scanCmd = &cobra.Command{
}

// format and combine flag and positional args
targetHosts = append(targetHosts, util.FormatHostUrls(args, ports, scheme, verbose)...)
targetHosts = append(targetHosts, util.FormatHostUrls(hosts, ports, scheme, verbose)...)
targetHosts = append(targetHosts, client.FormatHostUrls(args, ports, scheme, verbose)...)
targetHosts = append(targetHosts, client.FormatHostUrls(hosts, ports, scheme, verbose)...)

// add more hosts specified with `--subnet` flag
if debug {
Expand Down
2 changes: 1 addition & 1 deletion cmd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var (
var updateCmd = &cobra.Command{
Use: "update hosts...",
Short: "Update BMC node firmware",
Long: "Perform an firmware update using Redfish by providing a remote firmware URL and component.\n" +
Long: "Perform an firmware update using Redfish by providing a remote firmware URL and component.\n\n" +
"Examples:\n" +
" magellan update --bmc.host 172.16.0.108 --bmc.port 443 --username bmc_username --password bmc_password --firmware-url http://172.16.0.200:8005/firmware/bios/image.RBU --component BIOS\n" +
" magellan update --status --bmc.host 172.16.0.108 --bmc.port 443 --username bmc_username --password bmc_password",
Expand Down

0 comments on commit 3287d76

Please sign in to comment.