Skip to content

Commit 04cff6d

Browse files
committed
fix(cmd/rofl): Fix admin address handling
1 parent d4367ef commit 04cff6d

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

cmd/rofl/mgmt.go

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"sort"
1414

1515
"github.com/spf13/cobra"
16-
flag "github.com/spf13/pflag"
1716

1817
"github.com/oasisprotocol/oasis-core/go/common/sgx/pcs"
1918
"github.com/oasisprotocol/oasis-core/go/common/sgx/quote"
@@ -37,9 +36,8 @@ var (
3736
"cn": rofl.CreatorNonce,
3837
}
3938

40-
scheme string
41-
adminAddress string
42-
pubName string
39+
scheme string
40+
pubName string
4341

4442
appTEE string
4543
appKind string
@@ -302,9 +300,6 @@ var (
302300
NeedAdmin: true,
303301
})
304302

305-
if adminAddress == "" && deployment.Admin != "" {
306-
adminAddress = "self"
307-
}
308303
secrets := buildRofl.PrepareSecrets(deployment.Secrets)
309304

310305
var appID rofl.AppID
@@ -315,10 +310,6 @@ var (
315310
npa.MustHaveAccount()
316311
npa.MustHaveParaTime()
317312

318-
if adminAddress == "" {
319-
fmt.Println("You must specify --admin or configure an admin in the manifest.")
320-
return
321-
}
322313
if deployment.Policy == nil {
323314
fmt.Println("You must configure policy in the manifest.")
324315
return
@@ -341,11 +332,8 @@ var (
341332
}
342333

343334
// Update administrator address.
344-
if adminAddress == "self" {
345-
adminAddress = npa.AccountName
346-
}
347335
var err error
348-
updateBody.Admin, _, err = common.ResolveLocalAccountOrAddress(npa.Network, adminAddress)
336+
updateBody.Admin, _, err = common.ResolveLocalAccountOrAddress(npa.Network, deployment.Admin)
349337
if err != nil {
350338
cobra.CheckErr(fmt.Errorf("bad administrator address: %w", err))
351339
}
@@ -819,10 +807,6 @@ func detectOrCreateComposeFile() string {
819807
}
820808

821809
func init() {
822-
updateFlags := flag.NewFlagSet("", flag.ContinueOnError)
823-
updateFlags.StringVar(&adminAddress, "admin", "", "set the administrator address")
824-
updateCmd.Flags().AddFlagSet(roflCommon.DeploymentFlags)
825-
826810
initCmd.Flags().StringVar(&appTEE, "tee", "tdx", "TEE kind [tdx, sgx]")
827811
initCmd.Flags().StringVar(&appKind, "kind", "container", "ROFL app kind [container, raw]")
828812

@@ -832,10 +816,9 @@ func init() {
832816
createCmd.Flags().AddFlagSet(roflCommon.NoUpdateFlag)
833817
createCmd.Flags().StringVar(&scheme, "scheme", "cn", "app ID generation scheme: creator+round+index [cri] or creator+nonce [cn]")
834818

835-
updateCmd.Flags().AddFlagSet(common.SelectorFlags)
819+
updateCmd.Flags().AddFlagSet(common.AccountFlag)
836820
updateCmd.Flags().AddFlagSet(common.RuntimeTxFlags)
837821
updateCmd.Flags().AddFlagSet(roflCommon.DeploymentFlags)
838-
updateCmd.Flags().AddFlagSet(updateFlags)
839822

840823
removeCmd.Flags().AddFlagSet(common.SelectorFlags)
841824
removeCmd.Flags().AddFlagSet(common.RuntimeTxFlags)

0 commit comments

Comments
 (0)