Add remote command

This change introduces the remote command. The remote command will be
used to control the power of remote nodes and eventually include the
"bootstrap remotedirect" functionality.

This change is merely an outline of the command. No functionality is
included in this change.

Closes #117

Change-Id: I3291405f36d6a7acc5c8c1f07bd90ad9c2986cd3
Signed-off-by: Drew Walters <andrew.walters@att.com>
This commit is contained in:
Drew Walters 2020-03-18 18:56:13 +00:00
parent b4b792a04f
commit d25c22a538
5 changed files with 78 additions and 0 deletions

33
cmd/remote/remote.go Normal file
View File

@ -0,0 +1,33 @@
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package remote
import (
"github.com/spf13/cobra"
"opendev.org/airship/airshipctl/pkg/environment"
"opendev.org/airship/airshipctl/pkg/errors"
)
// NewRemoteCommand creates a new command that provides functionality to control remote entities.
func NewRemoteCommand(rootSettings *environment.AirshipCTLSettings) *cobra.Command {
remoteRootCmd := &cobra.Command{
Use: "remote",
Short: "Control remote entities, i.e. hosts.",
RunE: func(cmd *cobra.Command, args []string) error {
return errors.ErrNotImplemented{}
},
}
return remoteRootCmd
}

35
cmd/remote/remote_test.go Normal file
View File

@ -0,0 +1,35 @@
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package remote
import (
"testing"
"opendev.org/airship/airshipctl/pkg/errors"
"opendev.org/airship/airshipctl/testutil"
)
func TestRemoteCommand(t *testing.T) {
tests := []*testutil.CmdTest{
{
Name: "remote-error-not-implemented",
CmdLine: "",
Cmd: NewRemoteCommand(nil),
Error: errors.ErrNotImplemented{},
},
}
for _, tt := range tests {
testutil.RunTest(t, tt)
}
}

View File

@ -0,0 +1,7 @@
Error: Not implemented
Usage:
remote [flags]
Flags:
-h, --help help for remote

View File

@ -13,6 +13,7 @@ import (
"opendev.org/airship/airshipctl/cmd/completion"
"opendev.org/airship/airshipctl/cmd/config"
"opendev.org/airship/airshipctl/cmd/document"
"opendev.org/airship/airshipctl/cmd/remote"
"opendev.org/airship/airshipctl/cmd/secret"
"opendev.org/airship/airshipctl/pkg/environment"
"opendev.org/airship/airshipctl/pkg/log"
@ -56,6 +57,7 @@ func AddDefaultAirshipCTLCommands(cmd *cobra.Command, settings *environment.Airs
cmd.AddCommand(completion.NewCompletionCommand())
cmd.AddCommand(document.NewDocumentCommand(settings))
cmd.AddCommand(config.NewConfigCommand(settings))
cmd.AddCommand(remote.NewRemoteCommand(settings))
cmd.AddCommand(secret.NewSecretCommand())
return cmd

View File

@ -10,6 +10,7 @@ Available Commands:
config Modify airshipctl config files
document manages deployment documents
help Help about any command
remote Control remote entities, i.e. hosts.
secret manages secrets
version Show the version number of airshipctl