mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-25 15:39:37 -05:00
IDsFilename -> ClusterIDsFilename
This commit is contained in:
parent
24cba8d91a
commit
259c88fa1a
@ -1,6 +1,6 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
type clusterIDFile struct {
|
type clusterIDsFile struct {
|
||||||
ClusterID string
|
ClusterID string
|
||||||
OwnerID string
|
OwnerID string
|
||||||
Endpoint string
|
Endpoint string
|
||||||
|
@ -267,8 +267,8 @@ func (r activationResult) writeOutput(wr io.Writer, fileHandler file.Handler) er
|
|||||||
return fmt.Errorf("write kubeconfig: %w", err)
|
return fmt.Errorf("write kubeconfig: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
idFile := clusterIDFile{ClusterID: r.clusterID, OwnerID: r.ownerID, Endpoint: r.coordinatorPubIP}
|
idFile := clusterIDsFile{ClusterID: r.clusterID, OwnerID: r.ownerID, Endpoint: r.coordinatorPubIP}
|
||||||
if err := fileHandler.WriteJSON(constants.IDsFileName, idFile, file.OptNone); err != nil {
|
if err := fileHandler.WriteJSON(constants.ClusterIDsFileName, idFile, file.OptNone); err != nil {
|
||||||
return fmt.Errorf("writing Constellation id file: %w", err)
|
return fmt.Errorf("writing Constellation id file: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ func TestWriteOutput(t *testing.T) {
|
|||||||
kubeconfig: "foo-bar-baz-qq",
|
kubeconfig: "foo-bar-baz-qq",
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedIdFile := clusterIDFile{
|
expectedIdFile := clusterIDsFile{
|
||||||
Endpoint: result.coordinatorPubIP,
|
Endpoint: result.coordinatorPubIP,
|
||||||
ClusterID: result.clusterID,
|
ClusterID: result.clusterID,
|
||||||
OwnerID: result.ownerID,
|
OwnerID: result.ownerID,
|
||||||
@ -356,9 +356,9 @@ func TestWriteOutput(t *testing.T) {
|
|||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
assert.Equal(result.kubeconfig, string(adminConf))
|
assert.Equal(result.kubeconfig, string(adminConf))
|
||||||
|
|
||||||
idsFile, err := afs.ReadFile(constants.IDsFileName)
|
idsFile, err := afs.ReadFile(constants.ClusterIDsFileName)
|
||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
var testIdFile clusterIDFile
|
var testIdFile clusterIDsFile
|
||||||
err = json.Unmarshal(idsFile, &testIdFile)
|
err = json.Unmarshal(idsFile, &testIdFile)
|
||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
assert.Equal(expectedIdFile, testIdFile)
|
assert.Equal(expectedIdFile, testIdFile)
|
||||||
|
@ -28,7 +28,7 @@ func NewVerifyCmd() *cobra.Command {
|
|||||||
Short: "Verify the confidential properties of a Constellation cluster",
|
Short: "Verify the confidential properties of a Constellation cluster",
|
||||||
Long: `Verify the confidential properties of a Constellation cluster.
|
Long: `Verify the confidential properties of a Constellation cluster.
|
||||||
|
|
||||||
If arguments aren't specified, values are read from ` + "`" + constants.IDsFileName + "`.",
|
If arguments aren't specified, values are read from ` + "`" + constants.ClusterIDsFileName + "`.",
|
||||||
Args: cobra.MatchAll(
|
Args: cobra.MatchAll(
|
||||||
cobra.ExactArgs(1),
|
cobra.ExactArgs(1),
|
||||||
isCloudProvider(0),
|
isCloudProvider(0),
|
||||||
@ -123,11 +123,11 @@ func parseVerifyFlags(cmd *cobra.Command, fileHandler file.Handler) (verifyFlags
|
|||||||
if emptyEndpoint || emptyIDs {
|
if emptyEndpoint || emptyIDs {
|
||||||
if details, err := readIds(fileHandler); err == nil {
|
if details, err := readIds(fileHandler); err == nil {
|
||||||
if emptyEndpoint {
|
if emptyEndpoint {
|
||||||
cmd.Printf("Using endpoint from %q. Specify --node-endpoint to override this.\n", constants.IDsFileName)
|
cmd.Printf("Using endpoint from %q. Specify --node-endpoint to override this.\n", constants.ClusterIDsFileName)
|
||||||
endpoint = details.Endpoint
|
endpoint = details.Endpoint
|
||||||
}
|
}
|
||||||
if emptyIDs {
|
if emptyIDs {
|
||||||
cmd.Printf("Using IDs from %q. Specify --owner-id and/or --unique-id to override this.\n", constants.IDsFileName)
|
cmd.Printf("Using IDs from %q. Specify --owner-id and/or --unique-id to override this.\n", constants.ClusterIDsFileName)
|
||||||
ownerID = details.OwnerID
|
ownerID = details.OwnerID
|
||||||
clusterID = details.ClusterID
|
clusterID = details.ClusterID
|
||||||
}
|
}
|
||||||
@ -160,10 +160,10 @@ type verifyFlags struct {
|
|||||||
configPath string
|
configPath string
|
||||||
}
|
}
|
||||||
|
|
||||||
func readIds(fileHandler file.Handler) (clusterIDFile, error) {
|
func readIds(fileHandler file.Handler) (clusterIDsFile, error) {
|
||||||
det := clusterIDFile{}
|
det := clusterIDsFile{}
|
||||||
if err := fileHandler.ReadJSON(constants.IDsFileName, &det); err != nil {
|
if err := fileHandler.ReadJSON(constants.ClusterIDsFileName, &det); err != nil {
|
||||||
return clusterIDFile{}, fmt.Errorf("reading cluster ids: %w", err)
|
return clusterIDsFile{}, fmt.Errorf("reading cluster ids: %w", err)
|
||||||
}
|
}
|
||||||
return det, nil
|
return det, nil
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ func TestVerify(t *testing.T) {
|
|||||||
configFlag string
|
configFlag string
|
||||||
ownerIDFlag string
|
ownerIDFlag string
|
||||||
clusterIDFlag string
|
clusterIDFlag string
|
||||||
idFile *clusterIDFile
|
idFile *clusterIDsFile
|
||||||
wantEndpoint string
|
wantEndpoint string
|
||||||
wantErr bool
|
wantErr bool
|
||||||
}{
|
}{
|
||||||
@ -106,7 +106,7 @@ func TestVerify(t *testing.T) {
|
|||||||
provider: cloudprovider.GCP,
|
provider: cloudprovider.GCP,
|
||||||
ownerIDFlag: zeroBase64,
|
ownerIDFlag: zeroBase64,
|
||||||
protoClient: &stubVerifyClient{},
|
protoClient: &stubVerifyClient{},
|
||||||
idFile: &clusterIDFile{Endpoint: "192.0.2.1:1234"},
|
idFile: &clusterIDsFile{Endpoint: "192.0.2.1:1234"},
|
||||||
wantEndpoint: "192.0.2.1:1234",
|
wantEndpoint: "192.0.2.1:1234",
|
||||||
},
|
},
|
||||||
"override endpoint from details file": {
|
"override endpoint from details file": {
|
||||||
@ -115,7 +115,7 @@ func TestVerify(t *testing.T) {
|
|||||||
nodeEndpointFlag: "192.0.2.2:1234",
|
nodeEndpointFlag: "192.0.2.2:1234",
|
||||||
ownerIDFlag: zeroBase64,
|
ownerIDFlag: zeroBase64,
|
||||||
protoClient: &stubVerifyClient{},
|
protoClient: &stubVerifyClient{},
|
||||||
idFile: &clusterIDFile{Endpoint: "192.0.2.1:1234"},
|
idFile: &clusterIDsFile{Endpoint: "192.0.2.1:1234"},
|
||||||
wantEndpoint: "192.0.2.2:1234",
|
wantEndpoint: "192.0.2.2:1234",
|
||||||
},
|
},
|
||||||
"invalid endpoint": {
|
"invalid endpoint": {
|
||||||
@ -137,7 +137,7 @@ func TestVerify(t *testing.T) {
|
|||||||
provider: cloudprovider.GCP,
|
provider: cloudprovider.GCP,
|
||||||
nodeEndpointFlag: "192.0.2.1:1234",
|
nodeEndpointFlag: "192.0.2.1:1234",
|
||||||
protoClient: &stubVerifyClient{},
|
protoClient: &stubVerifyClient{},
|
||||||
idFile: &clusterIDFile{OwnerID: zeroBase64},
|
idFile: &clusterIDsFile{OwnerID: zeroBase64},
|
||||||
wantEndpoint: "192.0.2.1:1234",
|
wantEndpoint: "192.0.2.1:1234",
|
||||||
},
|
},
|
||||||
"config file not existing": {
|
"config file not existing": {
|
||||||
@ -191,7 +191,7 @@ func TestVerify(t *testing.T) {
|
|||||||
fileHandler := file.NewHandler(tc.setupFs(require))
|
fileHandler := file.NewHandler(tc.setupFs(require))
|
||||||
|
|
||||||
if tc.idFile != nil {
|
if tc.idFile != nil {
|
||||||
require.NoError(fileHandler.WriteJSON(constants.IDsFileName, tc.idFile, file.OptNone))
|
require.NoError(fileHandler.WriteJSON(constants.ClusterIDsFileName, tc.idFile, file.OptNone))
|
||||||
}
|
}
|
||||||
|
|
||||||
err := verify(cmd, tc.provider, fileHandler, tc.protoClient)
|
err := verify(cmd, tc.provider, fileHandler, tc.protoClient)
|
||||||
|
@ -50,7 +50,7 @@ const (
|
|||||||
//
|
//
|
||||||
|
|
||||||
StateFilename = "constellation-state.json"
|
StateFilename = "constellation-state.json"
|
||||||
IDsFileName = "constellation-id.json"
|
ClusterIDsFileName = "constellation-id.json"
|
||||||
ConfigFilename = "constellation-conf.yaml"
|
ConfigFilename = "constellation-conf.yaml"
|
||||||
DebugdConfigFilename = "cdbg-conf.yaml"
|
DebugdConfigFilename = "cdbg-conf.yaml"
|
||||||
AdminConfFilename = "constellation-admin.conf"
|
AdminConfFilename = "constellation-admin.conf"
|
||||||
|
Loading…
Reference in New Issue
Block a user