Uplift airshipctl reference

Updates reference for airshipctl modules and preserves existing
airship UI functionality.

Known issue: this update introduces an "overwrite" flag in ctl's
config package that will need to be incorporated into the UI
when an airship config file is initialized

Change-Id: I168592fa2c662c151e22519f1e9e445416610143
This commit is contained in:
Matthew Fuller 2020-12-02 19:07:27 +00:00
parent d4d8e0174a
commit 888640a614
5 changed files with 23 additions and 8 deletions

2
go.mod
View File

@ -10,7 +10,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.0.0
github.com/stretchr/testify v1.6.1
opendev.org/airship/airshipctl v0.0.0-20201111150845-f2e305a56df7
opendev.org/airship/airshipctl v0.0.0-20201202171555-92ceea55814a
sigs.k8s.io/cli-utils v0.20.6
sigs.k8s.io/kustomize/api v0.5.1
)

4
go.sum
View File

@ -1070,8 +1070,8 @@ modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I=
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
opendev.org/airship/airshipctl v0.0.0-20201111150845-f2e305a56df7 h1:dcznVahv2IeR+VF88zRfgz6VTiUlDMIx+jVKEUvIVYE=
opendev.org/airship/airshipctl v0.0.0-20201111150845-f2e305a56df7/go.mod h1:qnuSTEEmInUS+zk7fMvNeDEloiTqlHlRsEmWFXlT+pU=
opendev.org/airship/airshipctl v0.0.0-20201202171555-92ceea55814a h1:K712I4vya/0niLw1n9AsFdPXSdQ5a1jaZ0EGA/i37bA=
opendev.org/airship/airshipctl v0.0.0-20201202171555-92ceea55814a/go.mod h1:qnuSTEEmInUS+zk7fMvNeDEloiTqlHlRsEmWFXlT+pU=
opendev.org/airship/go-redfish v0.0.0-20200318103738-db034d1d753a h1:4ggAMTwpfu/w3ZXOIJ9tfYF37JIYn+eNCA4O10NduZ0=
opendev.org/airship/go-redfish v0.0.0-20200318103738-db034d1d753a/go.mod h1:FEjYcb3bYBWGpQIqtvVM0NrT5eyjlCOCj5JNf4lI+6s=
opendev.org/airship/go-redfish/client v0.0.0-20200318103738-db034d1d753a h1:S1dmsP5Cc6OQjAd6OgIKMcNPBiGjh5TDbijVjNE/VGU=

View File

@ -132,7 +132,13 @@ func InitAirshipConfig(request configs.WsMessage) configs.WsMessage {
confPath = filepath.Join(home, ".airship", "config")
}
err := ctlconfig.CreateConfig(confPath)
// TODO(mfuller): create a checkbox in frontend to allow setting of 'overwrite'
// This will probably require a InitOptions struct to capture the path and overwrite
// value, and it'll need to be sent in the Data message field. For now, we'll
// leave it set to a default of 'false'
overwrite := false
err := ctlconfig.CreateConfig(confPath, overwrite)
if err != nil {
e := err.Error()
response.Error = &e
@ -419,7 +425,11 @@ func SetManagementConfig(request configs.WsMessage) configs.WsMessage {
client.Config.ManagementConfiguration[request.Name] = &mCfg
err = client.Config.PersistConfig()
// since we're either creating a new management config or modifying an existing
// one in a known airship config file, we'll assume 'overwrite' to be true
overwrite := true
err = client.Config.PersistConfig(overwrite)
if err != nil {
e := err.Error()
response.Error = &e

View File

@ -75,6 +75,11 @@ func (p *UIEventProcessor) Process(ch <-chan events.Event) error {
return p.checkErrors()
}
// Close implements EventProcessor interface
func (p *UIEventProcessor) Close() {
close(p.eventsChan)
}
// TODO(mfuller): this function currently only adds errors if present,
// otherwise it sends a task message with the entire applyevent.Event
// object. At some point, we'll probably want to see how the printer

View File

@ -17,7 +17,7 @@ package ctl
import (
"fmt"
"opendev.org/airship/airshipctl/pkg/secret"
"opendev.org/airship/airshipctl/pkg/secret/generate"
"opendev.org/airship/airshipui/pkg/configs"
)
@ -53,7 +53,7 @@ func HandleSecretRequest(user *string, request configs.WsMessage) configs.WsMess
// generatePassphrase will generate a master passphrase to be used for encryption / decryption
func generatePassphrase() *string {
engine := secret.NewPassphraseEngine(nil)
masterPassphrase := engine.GeneratePassphrase()
engine := generate.NewEncryptionKeyEngine(nil)
masterPassphrase := engine.GenerateEncryptionKey()
return &masterPassphrase
}