Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Salmela <[email protected]>
  • Loading branch information
jacobsalmela committed May 20, 2024
1 parent 6faf078 commit 78132f7
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions internal/provider/ngsm/set_provider_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,28 @@
package ngsm

import (
"os"

nb "github.com/Cray-HPE/cani/pkg/netbox"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)

func (ngsm *Ngsm) SetProviderOptions(cmd *cobra.Command, args []string) (err error) {
if os.Getenv("NETBOX_URL") == "" {
log.Fatal().Msgf("NETBOX_URL must be set when using --bom")
}
// if os.Getenv("NETBOX_URL") == "" {
// log.Fatal().Msgf("NETBOX_URL must be set when using --bom")
// }

if os.Getenv("NETBOX_TOKEN") == "" {
log.Fatal().Msgf("NETBOX_TOKEN must be set when using --bom")
}
// IGNORE_SSL_ERRORS is optional
// if os.Getenv("NETBOX_TOKEN") == "" {
// log.Fatal().Msgf("NETBOX_TOKEN must be set when using --bom")
// }
// // IGNORE_SSL_ERRORS is optional

ngsm.Options.NetboxOpts.Host = os.Getenv("NETBOX_URL")
ngsm.Options.NetboxOpts.Token = os.Getenv("NETBOX_TOKEN")
if os.Getenv("IGNORE_SSL_ERRORS") == "True" {
ngsm.Options.NetboxOpts.Insecure = true
} else {
ngsm.Options.NetboxOpts.Insecure = false
}
// ngsm.Options.NetboxOpts.Host = os.Getenv("NETBOX_URL")
// ngsm.Options.NetboxOpts.Token = os.Getenv("NETBOX_TOKEN")
// if os.Getenv("IGNORE_SSL_ERRORS") == "True" {
// ngsm.Options.NetboxOpts.Insecure = true
// } else {
// ngsm.Options.NetboxOpts.Insecure = false
// }
if cmd.Flags().Changed("bom") {
// setup a new client
ngsm.NetboxClient, ngsm.context, err = nb.NewClient()
Expand Down

0 comments on commit 78132f7

Please sign in to comment.