Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inband firmware install #182

Merged
merged 20 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
fea8a7c
device/interface: split DeviceQueryor into interfaces for inband and …
joelrebel Aug 16, 2024
9f75e14
model/action: adds a few additional fields
joelrebel Aug 16, 2024
4e70140
model/firmware: turn InbandInstall, Oem attributes to be boolean
joelrebel Aug 16, 2024
2c1c8cc
app: load inband run mode configuration
joelrebel Aug 16, 2024
1b1100b
download: move download into its own package so its available for reuse
joelrebel Aug 16, 2024
ffdb421
inband: Add actions and firmware install action handlers
joelrebel Aug 16, 2024
3fb7ccd
runner: implement support to resume Actions and Steps
joelrebel Aug 16, 2024
4df09c4
worker/task_handler: implement support for both inband and outofband …
joelrebel Aug 16, 2024
4b6baa2
cmd: update cli to run inband and outofband installs
joelrebel Aug 16, 2024
eddcd6a
go: pin to ctrl, rivets with required changes
joelrebel Aug 16, 2024
a789d1e
oob/helpers: fixes incorrect BMC user parameter
joelrebel Aug 19, 2024
adfe3b1
download: increment timeout for slow connections
joelrebel Aug 19, 2024
6236eb6
go mod tidy
joelrebel Aug 19, 2024
237d2e1
store/fleetdb: copy inbandInstall, Oem bool values from firmware set …
joelrebel Aug 20, 2024
41f987a
inband: powercycle in the final component fw install action
joelrebel Aug 20, 2024
bf6442a
go: pin ctrl, ironlib deps
joelrebel Aug 20, 2024
27c22dc
go: update ironlib pin
joelrebel Aug 20, 2024
4a72d80
inband/action_handlers: set powercycle required bool
joelrebel Aug 20, 2024
d5ef06d
inband/action: fail if no update utility was identified
joelrebel Aug 21, 2024
1237287
go: pin to rivets, ctrl release
joelrebel Aug 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ packages:
fileName: "mock_{{.InterfaceName | firstLower}}.go"
inpackage: true
interfaces:
Queryor:
OutofbandQueryor:
InbandQueryor:
1 change: 1 addition & 0 deletions cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func runInstall(ctx context.Context) {
cfgFile,
logLevel,
enableProfiling,
model.RunOutofband,
)
if err != nil {
log.Fatal(err)
Expand Down
79 changes: 74 additions & 5 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import (
"log"

"github.com/equinix-labs/otel-init-go/otelinit"
"github.com/google/uuid"
"github.com/metal-toolbox/ctrl"
"github.com/metal-toolbox/flasher/internal/app"
"github.com/metal-toolbox/flasher/internal/metrics"
"github.com/metal-toolbox/flasher/internal/model"
"github.com/metal-toolbox/flasher/internal/store"
"github.com/metal-toolbox/flasher/internal/worker"

rctypes "github.com/metal-toolbox/rivets/condition"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
Expand All @@ -23,29 +26,40 @@ var cmdRun = &cobra.Command{
Use: "run",
Short: "Run flasher service to listen for events and install firmware",
Run: func(cmd *cobra.Command, _ []string) {
runWorker(cmd.Context())
var mode model.RunMode
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if runsInband {
mode = model.RunInband
} else {
mode = model.RunOutofband
}

runWorker(cmd.Context(), mode)
},
}

// run worker command
var (
dryrun bool
runsInband bool
runsOutofband bool
faultInjection bool
facilityCode string
storeKind string
inbandServerID string
)

var (
ErrInventoryStore = errors.New("inventory store error")
)

func runWorker(ctx context.Context) {
func runWorker(ctx context.Context, mode model.RunMode) {
flasher, termCh, err := app.New(
model.AppKindWorker,
model.StoreKind(storeKind),
cfgFile,
logLevel,
enableProfiling,
mode,
)
if err != nil {
log.Fatal(err)
Expand Down Expand Up @@ -76,6 +90,19 @@ func runWorker(ctx context.Context) {
flasher.Logger.Fatal("--facility-code parameter required")
}

switch mode {
case model.RunInband:
runInband(ctx, flasher, repository)
return
case model.RunOutofband:
runOutofband(ctx, flasher, repository)
return
default:
flasher.Logger.Fatal("unsupported run mode: " + mode)
}
}

func runOutofband(ctx context.Context, flasher *app.App, repository store.Repository) {
natsCfg, err := flasher.NatsParams()
if err != nil {
flasher.Logger.Fatal(err)
Expand All @@ -84,10 +111,10 @@ func runWorker(ctx context.Context) {
nc := ctrl.NewNatsController(
model.AppName,
facilityCode,
"firmwareInstall",
string(rctypes.FirmwareInstall),
natsCfg.NatsURL,
natsCfg.CredsFile,
"firmwareInstall",
rctypes.FirmwareInstall,
ctrl.WithConcurrency(flasher.Config.Concurrency),
ctrl.WithKVReplicas(natsCfg.KVReplicas),
ctrl.WithLogger(flasher.Logger),
Expand All @@ -108,6 +135,42 @@ func runWorker(ctx context.Context) {
)
}

func runInband(ctx context.Context, flasher *app.App, repository store.Repository) {
cfgOrcAPI := flasher.Config.OrchestratorAPIParams
orcConfig := &ctrl.OrchestratorAPIConfig{
Endpoint: cfgOrcAPI.Endpoint,
AuthDisabled: cfgOrcAPI.AuthDisabled,
AuthToken: cfgOrcAPI.AuthToken,
OidcIssuerEndpoint: cfgOrcAPI.OidcIssuerEndpoint,
OidcAudienceEndpoint: cfgOrcAPI.OidcAudienceEndpoint,
OidcClientSecret: cfgOrcAPI.OidcClientSecret,
OidcClientID: cfgOrcAPI.OidcClientID,
OidcClientScopes: cfgOrcAPI.OidcClientScopes,
}

nc, err := ctrl.NewHTTPController(
"flasher-inband",
facilityCode,
uuid.MustParse(flasher.Config.ServerID),
rctypes.FirmwareInstallInband,
orcConfig,
ctrl.WithNATSHTTPLogger(flasher.Logger),
)
if err != nil {
flasher.Logger.Fatal(err)
}

worker.RunInband(
ctx,
dryrun,
faultInjection,
facilityCode,
repository,
nc,
flasher.Logger,
)
}

func initStore(ctx context.Context, config *app.Configuration, logger *logrus.Logger) (store.Repository, error) {
if storeKind == string(model.InventoryStoreServerservice) {
return store.NewServerserviceStore(ctx, config.FleetDBAPIOptions, logger)
Expand All @@ -117,14 +180,20 @@ func initStore(ctx context.Context, config *app.Configuration, logger *logrus.Lo
}

func init() {
cmdRun.PersistentFlags().StringVar(&storeKind, "store", "", "Inventory store to lookup devices for update - 'serverservice' or an inventory file with a .yml/.yaml extenstion")
cmdRun.PersistentFlags().StringVar(&storeKind, "store", "", "Inventory store to lookup devices for update - fleetdb.")
cmdRun.PersistentFlags().StringVar(&inbandServerID, "server-id", "", "ServerID when running inband")
cmdRun.PersistentFlags().BoolVarP(&dryrun, "dry-run", "", false, "In dryrun mode, the worker actions the task without installing firmware")
cmdRun.PersistentFlags().BoolVarP(&runsInband, "inband", "", false, "Runs worker in inband firmware install mode")
cmdRun.PersistentFlags().BoolVarP(&runsOutofband, "outofband", "", false, "Runs worker in out-of-band firmware install mode")
cmdRun.PersistentFlags().BoolVarP(&faultInjection, "fault-injection", "", false, "Tasks can include a Fault attribute to allow fault injection for development purposes")
cmdRun.PersistentFlags().StringVar(&facilityCode, "facility-code", "", "The facility code this flasher instance is associated with")

if err := cmdRun.MarkPersistentFlagRequired("store"); err != nil {
log.Fatal(err)
}

cmdRun.MarkFlagsMutuallyExclusive("inband", "outofband")
cmdRun.MarkFlagsOneRequired("inband", "outofband")

rootCmd.AddCommand(cmdRun)
}
20 changes: 10 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22
require (
github.com/banzaicloud/logrus-runtime-formatter v0.0.0-20190729070250-5ae5475bae5e
github.com/bmc-toolbox/bmclib/v2 v2.2.6
github.com/bmc-toolbox/common v0.0.0-20240723142833-87832458b53b
github.com/bmc-toolbox/common v0.0.0-20240806132831-ba8adc6a35e3
github.com/bombsimon/logrusr/v2 v2.0.1
github.com/coreos/go-oidc/v3 v3.11.0
github.com/emicklei/dot v1.6.2
Expand All @@ -15,10 +15,10 @@ require (
github.com/hashicorp/go-retryablehttp v0.7.7
github.com/jeremywohl/flatten v1.0.1
github.com/jpillora/backoff v1.0.0
github.com/metal-toolbox/ctrl v0.2.1
github.com/metal-toolbox/ctrl v0.2.2-0.20240820153810-9f5f8ffcb086
github.com/metal-toolbox/fleetdb v1.19.3
github.com/metal-toolbox/ironlib v0.4.1
github.com/metal-toolbox/rivets v1.2.1-0.20240809101507-f574730a9963
github.com/metal-toolbox/ironlib v0.4.2-0.20240820160227-1a7996f5b77c
github.com/metal-toolbox/rivets v1.3.1
github.com/mitchellh/copystructure v1.2.0
github.com/mitchellh/mapstructure v1.5.0
github.com/pkg/errors v0.9.1
Expand All @@ -31,7 +31,7 @@ require (
go.opentelemetry.io/otel v1.28.0
go.opentelemetry.io/otel/trace v1.28.0
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
golang.org/x/net v0.27.0
golang.org/x/net v0.28.0
golang.org/x/oauth2 v0.22.0
)

Expand All @@ -40,7 +40,7 @@ require (
github.com/Jeffail/gabs/v2 v2.7.0 // indirect
github.com/VictorLowther/simplexml v0.0.0-20180716164440-0bff93621230 // indirect
github.com/VictorLowther/soap v0.0.0-20150314151524-8e36fca84b22 // indirect
github.com/beevik/etree v1.4.0 // indirect
github.com/beevik/etree v1.4.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bytedance/sonic v1.12.0 // indirect
github.com/bytedance/sonic/loader v0.2.0 // indirect
Expand Down Expand Up @@ -124,7 +124,7 @@ require (
github.com/stmcginnis/gofish v0.15.1-0.20231121142100-22a60a77be91 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tidwall/gjson v1.17.1 // indirect
github.com/tidwall/gjson v1.17.3 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
Expand All @@ -149,9 +149,9 @@ require (
go.uber.org/zap v1.27.0 // indirect
gocloud.dev v0.38.0 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect
google.golang.org/api v0.189.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240730163845-b1a4ccb954bf // indirect
Expand Down
30 changes: 22 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,17 @@ github.com/banzaicloud/logrus-runtime-formatter v0.0.0-20190729070250-5ae5475bae
github.com/banzaicloud/logrus-runtime-formatter v0.0.0-20190729070250-5ae5475bae5e/go.mod h1:hEvEpPmuwKO+0TbrDQKIkmX0gW2s2waZHF8pIhEEmpM=
github.com/beevik/etree v1.4.0 h1:oz1UedHRepuY3p4N5OjE0nK1WLCqtzHf25bxplKOHLs=
github.com/beevik/etree v1.4.0/go.mod h1:cyWiXwGoasx60gHvtnEh5x8+uIjUVnjWqBvEnhnqKDA=
github.com/beevik/etree v1.4.1 h1:PmQJDDYahBGNKDcpdX8uPy1xRCwoCGVUiW669MEirVI=
github.com/beevik/etree v1.4.1/go.mod h1:gPNJNaBGVZ9AwsidazFZyygnd+0pAU38N4D+WemwKNs=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bmc-toolbox/bmclib/v2 v2.2.6 h1:ol2jVa1ERfBFZS5Ye1chORai+nkzt9J1LgTTMxjZ0mw=
github.com/bmc-toolbox/bmclib/v2 v2.2.6/go.mod h1:V2XVg0Scpm16+0gE7WnI+5bU/M0c/o/nPZKHKzyVjAo=
github.com/bmc-toolbox/common v0.0.0-20240723142833-87832458b53b h1:0LHjikaGWlqEMczrCEZ6w1N/ZqcYlx6WRHkhabRUQEk=
github.com/bmc-toolbox/common v0.0.0-20240723142833-87832458b53b/go.mod h1:Cdnkm+edb6C0pVkyCrwh3JTXAe0iUF9diDG/DztPI9I=
github.com/bmc-toolbox/common v0.0.0-20240806132831-ba8adc6a35e3 h1:/BjZSX/sphptIdxpYo4wxAQkgMLyMMgfdl48J9DKNeE=
github.com/bmc-toolbox/common v0.0.0-20240806132831-ba8adc6a35e3/go.mod h1:Cdnkm+edb6C0pVkyCrwh3JTXAe0iUF9diDG/DztPI9I=
github.com/bombsimon/logrusr/v2 v2.0.1 h1:1VgxVNQMCvjirZIYaT9JYn6sAVGVEcNtRE0y4mvaOAM=
github.com/bombsimon/logrusr/v2 v2.0.1/go.mod h1:ByVAX+vHdLGAfdroiMg6q0zgq2FODY2lc5YJvzmOJio=
github.com/bytedance/sonic v1.12.0 h1:YGPgxF9xzaCNvd/ZKdQ28yRovhfMFZQjuk6fKBzZ3ls=
Expand Down Expand Up @@ -560,14 +562,16 @@ github.com/mattn/go-sqlite3 v2.0.1+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/metal-toolbox/conditionorc v1.1.1-0.20240805163108-b1c018c91b87 h1:C3Gkj7+bV18HgXJuzeJ6RAttzqsO6sDBF7I20x5JvWM=
github.com/metal-toolbox/conditionorc v1.1.1-0.20240805163108-b1c018c91b87/go.mod h1:0Rh7BPun3VcJzxsBfbZ94lxxxSUNLtugAeZPRWPcD3c=
github.com/metal-toolbox/ctrl v0.2.1 h1:CYOOsmX7SNBFJjxDIWWW76imGXlIfxO8KEKlUffXAak=
github.com/metal-toolbox/ctrl v0.2.1/go.mod h1:VfYYvY7SAvHjN+PTPsaahaazM7gKWq5s37aS3kX4KKo=
github.com/metal-toolbox/ctrl v0.2.2-0.20240820153810-9f5f8ffcb086 h1:zHwQHtYDkoz806ZtHhf5/EZ2TRjZ+XVxeMl1vQSkDVM=
github.com/metal-toolbox/ctrl v0.2.2-0.20240820153810-9f5f8ffcb086/go.mod h1:pN64bE8tqvG2x1YpS62lfwEPOzMh98lXwyF11t8VLYw=
github.com/metal-toolbox/fleetdb v1.19.3 h1:Dk7MVi5rS42a4OI46Ye/etg8R5hm1iajaI4U0k1GSec=
github.com/metal-toolbox/fleetdb v1.19.3/go.mod h1:v9agAzF7BhBBjA4rY+H2eZzQaBTEXO4b/Qikn4jmA7A=
github.com/metal-toolbox/ironlib v0.4.1 h1:AL9xYNjViIdR7xEGxu8KHZb92uzSISYEFkU094s+21A=
github.com/metal-toolbox/ironlib v0.4.1/go.mod h1:YNS/N5Q61awwVEXJ20V04AzLrgSsT/Xrh8bHD6Iwi7M=
github.com/metal-toolbox/rivets v1.2.1-0.20240809101507-f574730a9963 h1:VtVyh556iekeYNrxUiD5Q3L5rY4F4O7X3ZULnKWNHvk=
github.com/metal-toolbox/rivets v1.2.1-0.20240809101507-f574730a9963/go.mod h1:i78a1x0w2uNyMlvUgyO6ST552u9wV2Xa4+A73oA4WJY=
github.com/metal-toolbox/ironlib v0.4.2-0.20240820154349-f72c0f707be4 h1:Y8/TwjcBmCryADtIbGlPVpzaHcmnTbBBkpqFMD/Alk0=
github.com/metal-toolbox/ironlib v0.4.2-0.20240820154349-f72c0f707be4/go.mod h1:YNS/N5Q61awwVEXJ20V04AzLrgSsT/Xrh8bHD6Iwi7M=
github.com/metal-toolbox/ironlib v0.4.2-0.20240820160227-1a7996f5b77c h1:j9X/iktguadGJMMQ6UuI+qGA8r5bM/CQQM7HWF/pEww=
github.com/metal-toolbox/ironlib v0.4.2-0.20240820160227-1a7996f5b77c/go.mod h1:WQZ8tZ8+bCts6mgBhN9M2r6Mer0aS8M0JNcaZm1dIS4=
github.com/metal-toolbox/rivets v1.3.1 h1:UD70qh6KNNgCPivAP7Ed4U8H8aJ3+3Bw8FtyMXiM7Qg=
github.com/metal-toolbox/rivets v1.3.1/go.mod h1:i78a1x0w2uNyMlvUgyO6ST552u9wV2Xa4+A73oA4WJY=
github.com/microsoft/go-mssqldb v0.17.0/go.mod h1:OkoNGhGEs8EZqchVTtochlXruEhEOaO4S0d2sB5aeGQ=
github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI=
Expand Down Expand Up @@ -741,6 +745,8 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U=
github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.17.3 h1:bwWLZU7icoKRG+C+0PNwIKC6FCJO/Q3p2pZvuP0jN94=
github.com/tidwall/gjson v1.17.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
Expand Down Expand Up @@ -862,6 +868,8 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf
golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ=
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -956,6 +964,8 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -1087,6 +1097,8 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand All @@ -1107,6 +1119,8 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
5 changes: 4 additions & 1 deletion internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ type App struct {
Logger *logrus.Logger
// Kind is the type of application - worker
Kind model.AppKind
// Mode indicates the means of installing firmware on the target
Mode model.RunMode
}

// New returns returns a new instance of the flasher app
func New(appKind model.AppKind, storeKind model.StoreKind, cfgFile, loglevel string, profiling bool) (*App, <-chan os.Signal, error) {
func New(appKind model.AppKind, storeKind model.StoreKind, cfgFile, loglevel string, profiling bool, mode model.RunMode) (*App, <-chan os.Signal, error) {
if appKind != model.AppKindWorker && appKind != model.AppKindCLI {
return nil, nil, errors.Wrap(ErrAppInit, "invalid app kind: "+string(appKind))
}
Expand All @@ -50,6 +52,7 @@ func New(appKind model.AppKind, storeKind model.StoreKind, cfgFile, loglevel str
Kind: appKind,
Config: &Configuration{},
Logger: logrus.New(),
Mode: mode,
}

switch model.LogLevel(loglevel) {
Expand Down
Loading
Loading