Merge pull request #900 from openziti/cli-updates

Cli updates
This commit is contained in:
Paul Lorenz
2022-11-16 12:57:06 -05:00
committed by GitHub
277 changed files with 1469 additions and 4330 deletions
+26
View File
@@ -1,3 +1,29 @@
# Release 0.27.0
## What's New
* Ziti CLI
* The CLI has been cleaned up and unused, unusable and underused components have been removed or hidden
## Ziti CLI
* The update command has been removed. It was non-functional, so this should not affect anyone
* The adhoc, ping and playbook commands have been removed. These were ansible and vagrant commands that were not widely used.
* Make the art command hidden, doesn't need to be removed, leave it as an easter egg
* Move ziti ps command under ziti agent. Remove all ziti ps subcommands, as they already exist as ziti agent subcommands
* Add `ziti controller` and `ziti router` commands
* They should work exactly the same as `ziti-controller` and `ziti router`
* The standalone binaries for `ziti-controller` and `ziti-router` are deprecated and will be removed in a future release
* Add hidden `ziti tunnel` command
* Should work exactly the same as `ziti-tunnel`
* Is hidden as `ziti-edge-tunnel` is the preferred tunnelling application
* The standalone binary `ziti-tunnel` is deprecated and will be removed in a future release
* The db, log-format and unwrap commands have been moved under a new ops command
* ziti executable download management has been deprecated
* The init and uninstall commands have been removed
* The install, upgrade, use and version commands have been hidden and will be hidden once tests using them are updated or replaced
* The demo and tutorial commands have been moved under the new learn subcommand
# Release 0.26.11
## What's New
+2 -2
View File
@@ -19,16 +19,16 @@ package enrollment
import (
"encoding/json"
"fmt"
"github.com/openziti/ziti/ziti/cmd/common"
"io/ioutil"
"os"
"strings"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/identity/certtools"
"github.com/openziti/foundation/v2/term"
"github.com/openziti/identity/certtools"
"github.com/openziti/sdk-golang/ziti/config"
"github.com/openziti/sdk-golang/ziti/enroll"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
+10 -5
View File
@@ -1,6 +1,8 @@
# Overview
This local deployment README guides you to set up a running local Ziti stack. If you have not already built the apps in this repo you may go back to [the previous tutorial about getting set up for local development](./002-local-dev.md) for build instructions. The remainder of the tutorial will assume you have installed all the apps so they can be found in your shell's executable search `PATH`.
This local deployment README guides you to set up a running local Ziti stack. If you have not already built the apps in this repo you may go back
to [the previous tutorial about getting set up for local development](./002-local-dev.md) for build instructions. The remainder of the tutorial will assume you have installed all the apps so they can
be found in your shell's executable search `PATH`.
You will configure and run:
@@ -9,13 +11,15 @@ You will configure and run:
## A Note About Windows
These commands require a running BASH shell. Windows users will need to use WSL, [cygwin](https://www.cygwin.com/), a Linux virtual machine, or some other environment that supports BASH. The easiest thing might just be to use the shell that comes with [git bashfor windows](https://gitforwindows.org/). WSL is maturing more and more: [Mintty and WSL](https://github.com/mintty/wsltty).
These commands require a running BASH shell. Windows users will need to use WSL, [cygwin](https://www.cygwin.com/), a Linux virtual machine, or some other environment that supports BASH. The easiest
thing might just be to use the shell that comes with [git bashfor windows](https://gitforwindows.org/). WSL is maturing more and more: [Mintty and WSL](https://github.com/mintty/wsltty).
Also note that commands for `ziti`, `ziti-controller`, and `ziti-router` may need to have the `.exe` suffix appended to the example commands.
## Initialize the Environment
The remainder of this local development tutorital will instruct you to run terminal commands with current working directory of the top-level of this checked-out repo. The generated configuration files will use filesystem paths that are relative to this directory.
The remainder of this local development tutorital will instruct you to run terminal commands with current working directory of the top-level of this checked-out repo. The generated configuration files
will use filesystem paths that are relative to this directory.
Go ahead and create a `./db` directory. Git is configured to ignore this directory and it will house the tutorial files. You may delete this directory to reset the tutorial.
@@ -93,7 +97,8 @@ ziti-router enroll --jwt /tmp/router01.jwt ./db/router01-config.yml
## Run the Edge Router
Edge SDKs will connect to the running edge router to connect to services. Leave the router process running in a terminal so you can monitor the log messages while you continue the tutorial in a new terminal.
Edge SDKs will connect to the running edge router to connect to services. Leave the router process running in a terminal so you can monitor the log messages while you continue the tutorial in a new
terminal.
```bash
ziti-router run ./db/router01-config.yml
@@ -109,7 +114,7 @@ When prompted, select your running edge router `router01`.
ziti edge tutorial first-service
```
If you prefer, you may read [the first-service tutorial as a web site](../ziti/cmd/ziti/cmd/tutorial/tutorials/first-service.md)
If you prefer, you may read [the first-service tutorial as a web site](../ziti/cmd/tutorial/tutorials/first-service.md)
## Further Exploration
+2 -2
View File
@@ -17,10 +17,10 @@ Build Docker Image For Publication
1. issue this function to pull the latest ziti binaries: `getLatestZiti`
1. move the ziti binaries: `mv ziti-bin/ziti image/ziti.ignore/`
1. build the docker image: `docker build image -t openziti/quickstart`
1. exec into a container and make sure it's the version you expect: `docker run --rm -it openziti/quickstart ziti version`
1. exec into a container and make sure it's the version you expect: `docker run --rm -it openziti/quickstart ziti --version`
1. cleanup: `rm ziti-*tar.gz; rm -rf ziti-bin`
2.
Push Docker Image to dockerhub
------------------
1. `source ./image/ziti-cli-functions.sh`
1. just run `./pushLatestDocker.sh`
1. just run `./pushLatestDocker.sh`
+1 -1
View File
@@ -54,7 +54,7 @@ if [ -d "${ZITI_DOCKER_ROOT}/image/ziti.ignore" ]; then
rm -rf "${ZITI_DOCKER_ROOT}/image/ziti.ignore"
fi
docker run --rm -it openziti/quickstart:dev /openziti/ziti-bin/ziti version
echo "Ziti Version: $(docker run --rm -it openziti/quickstart:dev /openziti/ziti-bin/ziti --version)"
vers="$(echo "${ZITI_BINARIES_VERSION}" | cut -c 2-100)"
docker tag "openziti/quickstart:dev" "openziti/quickstart:dev"
+2 -2
View File
@@ -26,7 +26,7 @@ import (
"github.com/openziti/transport/v2/transwarptls"
"github.com/openziti/transport/v2/wss"
"github.com/openziti/ziti/common/version"
"github.com/openziti/ziti/ziti-controller/subcmd"
"github.com/openziti/ziti/ziti/controller"
"github.com/sirupsen/logrus"
)
@@ -44,5 +44,5 @@ func init() {
}
func main() {
subcmd.Execute()
controller.Execute()
}
-73
View File
@@ -1,73 +0,0 @@
/*
Copyright NetFoundry Inc.
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 subcmd
import (
"fmt"
"github.com/michaelquigley/pfxlog"
edgeSubCmd "github.com/openziti/edge/controller/subcmd"
"github.com/openziti/ziti/common/version"
"github.com/openziti/ziti/ziti/cmd/ziti/constants"
"github.com/openziti/ziti/ziti/cmd/ziti/util"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
func init() {
root.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging")
root.PersistentFlags().BoolVarP(&cliAgentEnabled, "cliagent", "a", true, "Enable/disabled CLI Agent (enabled by default)")
root.PersistentFlags().StringVar(&cliAgentAddr, "cli-agent-addr", "", "Specify where CLI Agent should list (ex: unix:/tmp/myfile.sock or tcp:127.0.0.1:10001)")
root.PersistentFlags().StringVar(&logFormatter, "log-formatter", "", "Specify log formatter [json|pfxlog|text]")
root.PersistentFlags().BoolVar(&syncRaftToDb, "sync-raft-to-db", false, "Sync the current database state to raft as a snapshot. Use when moving an existing controller to run in HA/Raft")
edgeSubCmd.AddCommands(root, version.GetCmdBuildInfo())
}
var root = &cobra.Command{
Use: "ziti-controller",
Short: "Ziti Fabric Controller",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
if verbose {
logrus.SetLevel(logrus.DebugLevel)
}
switch logFormatter {
case "pfxlog":
pfxlog.SetFormatter(pfxlog.NewFormatter(pfxlog.DefaultOptions().SetTrimPrefix("github.com/openziti/").StartingToday()))
case "json":
pfxlog.SetFormatter(&logrus.JSONFormatter{TimestampFormat: "2006-01-02T15:04:05.000Z"})
case "text":
pfxlog.SetFormatter(&logrus.TextFormatter{})
default:
// let logrus do its own thing
}
util.LogReleaseVersionCheck(constants.ZITI_CONTROLLER)
},
}
var verbose bool
var cliAgentEnabled bool
var cliAgentAddr string
var logFormatter string
var syncRaftToDb bool
func Execute() {
if err := root.Execute(); err != nil {
fmt.Printf("error: %s\n", err)
}
}
+2 -2
View File
@@ -28,7 +28,7 @@ import (
"github.com/openziti/transport/v2/ws"
"github.com/openziti/transport/v2/wss"
"github.com/openziti/ziti/common/version"
"github.com/openziti/ziti/ziti-router/subcmd"
"github.com/openziti/ziti/ziti/router"
"github.com/sirupsen/logrus"
)
@@ -48,5 +48,5 @@ func init() {
}
func main() {
subcmd.Execute()
router.Execute()
}
-69
View File
@@ -1,69 +0,0 @@
/*
Copyright NetFoundry Inc.
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 subcmd
import (
"fmt"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/ziti/ziti/cmd/ziti/constants"
"github.com/openziti/ziti/ziti/cmd/ziti/util"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
func init() {
root.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging")
root.PersistentFlags().StringVar(&logFormatter, "log-formatter", "", "Specify log formatter [json|pfxlog|text]")
root.PersistentFlags().BoolVar(&cliAgentEnabled, "cli-agent", true, "Enable/disable CLI Agent (enabled by default)")
root.PersistentFlags().StringVar(&cliAgentAddr, "cli-agent-addr", "", "Specify where CLI Agent should list (ex: unix:/tmp/myfile.sock or tcp:127.0.0.1:10001)")
root.PersistentFlags().BoolVar(&enableDebugOps, "debug-ops", false, "Enable/disable debug agent operations (disabled by default)")
}
var root = &cobra.Command{
Use: "ziti-router",
Short: "Ziti Fabric Router",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
if verbose {
logrus.SetLevel(logrus.DebugLevel)
}
switch logFormatter {
case "pfxlog":
pfxlog.SetFormatter(pfxlog.NewFormatter(pfxlog.DefaultOptions().SetTrimPrefix("github.com/openziti/").StartingToday()))
case "json":
pfxlog.SetFormatter(&logrus.JSONFormatter{TimestampFormat: "2006-01-02T15:04:05.000Z"})
case "text":
pfxlog.SetFormatter(&logrus.TextFormatter{})
default:
// let logrus do its own thing
}
util.LogReleaseVersionCheck(constants.ZITI_ROUTER)
},
}
var verbose bool
var logFormatter string
var cliAgentEnabled bool
var enableDebugOps bool
var cliAgentAddr string
func Execute() {
if err := root.Execute(); err != nil {
fmt.Printf("error: %s\n", err)
}
}
+2 -2
View File
@@ -19,7 +19,7 @@ package main
import (
"github.com/michaelquigley/pfxlog"
"github.com/openziti/foundation/v2/debugz"
"github.com/openziti/ziti/ziti-tunnel/cmd/ziti-tunnel/subcmd"
"github.com/openziti/ziti/ziti/tunnel"
"github.com/sirupsen/logrus"
)
@@ -29,5 +29,5 @@ func init() {
func main() {
debugz.AddStackDumpHandler()
subcmd.Execute()
tunnel.Execute()
}
-144
View File
@@ -1,144 +0,0 @@
/*
Copyright NetFoundry Inc.
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 ansible
import (
"fmt"
"os"
"path/filepath"
)
// Options for installing ansible
type InstallOptions struct {
RequirementsTXT string
VirtualEnv string
Path string
}
func InstallViaPip(options *InstallOptions) error {
// TODO
var (
virtualenvBinary string
virtualEnv string
pipBinary string
requirementsTXT string
err error
)
if options.Path != "" {
if _, err = os.Stat(options.Path); os.IsNotExist(err) {
return fmt.Errorf("The specified Path (%s) does not exist", options.Path)
}
}
cwd, _ := os.Getwd()
// if no requirements.txt is set we should check to see if we have one in
// dir in provided path or the current working dir, if so we can use that.
if options.RequirementsTXT == "" {
if options.Path != "" {
requirementsTXT = filepath.Join(options.Path, "requirements.txt")
} else {
requirementsTXT = filepath.Join(cwd, "requirements.txt")
}
if requirementsTXT != "" {
fmt.Printf("checking if %s exists... ", requirementsTXT)
if _, err = os.Stat(requirementsTXT); err == nil {
options.RequirementsTXT = requirementsTXT
fmt.Println("yes")
} else {
fmt.Println("no")
}
}
} else {
fmt.Printf("checking if %s exists... ", options.RequirementsTXT)
if _, err = os.Stat(options.RequirementsTXT); err == nil {
fmt.Println("yes")
} else {
fmt.Println("no")
return fmt.Errorf("(%s) does not exist", options.RequirementsTXT)
}
}
// if requesting virtualenv we need to make sure virtualenv binary exists
if options.VirtualEnv != "" {
virtualenvBinary = checkBinInPath("virtualenv")
if virtualenvBinary == "" {
return fmt.Errorf("unable to find virtualenv in path")
}
}
// if no virtualenv is set we should check to see if we have a virtualenv
// dir in provided path or the current working dir, if so we can use that.
if options.VirtualEnv == "" {
//fmt.Printf("you specified path %s\n", options.Path)
if options.Path != "" {
virtualEnv = filepath.Join(options.Path, "virtualenv")
options.VirtualEnv = virtualEnv
} else {
virtualEnv = filepath.Join(cwd, "virtualenv")
fmt.Printf("checking if %s exists... ", virtualEnv)
if _, err = os.Stat(virtualEnv); err == nil {
options.VirtualEnv = virtualEnv
fmt.Println("yes")
} else {
fmt.Println("no")
}
}
}
// if requesting virtualenv we need to make sure virtualenv binary exists
if options.VirtualEnv != "" {
virtualenvBinary = checkBinInPath("virtualenv")
if virtualenvBinary == "" {
return fmt.Errorf("unable to find virtualenv in path")
}
}
// if a virtualenv is specified make sure that pip is installed
// in it and use that, otherwise make sure its in path.
if options.VirtualEnv != "" {
fmt.Printf("Using VirtualEnv: %s\n", options.VirtualEnv)
pipBinary = filepath.Join(options.VirtualEnv, "bin", "pip")
if _, err = os.Stat(pipBinary); os.IsNotExist(err) {
err = runCmd(virtualenvBinary, []string{options.VirtualEnv})
if err != nil {
return err
}
}
} else {
pipBinary = checkBinInPath("pip")
}
if pipBinary == "" {
return fmt.Errorf("unable to find pip in path")
}
fmt.Printf("Using Pip: %s\n", pipBinary)
if options.RequirementsTXT != "" {
err = runCmd(pipBinary, []string{"install", "-r", options.RequirementsTXT})
if err != nil {
return err
}
} else {
err = runCmd(pipBinary, []string{"install", "ansible"})
if err != nil {
return err
}
}
return nil
}
-187
View File
@@ -1,187 +0,0 @@
/*
Copyright NetFoundry Inc.
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 ansible
import (
"bufio"
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
)
// Options for running ansible
type Options struct {
SSHConfigFile string
SSHForwardAgent bool
Provisioner string
Environment string
Inventory string
KnownHostsFile string
ModuleOptions
PlaybookOptions
}
// sets an environment variable
func setEnvironmentVariables(variable, value string) {
os.Setenv(variable, value)
}
// appends a string to an existing environment variable
func appendEnvironmentVariable(variable, value string) {
old := os.Getenv(variable)
new := []string{old, value}
os.Setenv(variable, strings.Join(new, " "))
}
// Checks if specified ssh config file exists, if not it
// checks if there is an ssh_config in the specified environment
// otherwise defaults to no ssh config.
// appends result to env var ANSIBLE_SSH_ARGS
func sshConfigFile(options *Options) error {
if options.SSHConfigFile == "" {
sshConfigFile := filepath.Join(options.Environment, "ssh_config")
if _, err := os.Stat(sshConfigFile); !os.IsNotExist(err) {
options.SSHConfigFile = sshConfigFile
}
} else {
if _, err := os.Stat(options.SSHConfigFile); os.IsNotExist(err) {
return fmt.Errorf("ssh_config file %s does not exist", options.SSHConfigFile)
}
}
if options.SSHConfigFile != "" {
appendEnvironmentVariable("ANSIBLE_SSH_ARGS",
fmt.Sprintf("-F %s", options.SSHConfigFile))
}
return nil
}
// isEnvironment checks if a given directory is a suitable environment
func isEnvironment(path string) bool {
fi, err := os.Stat(path)
switch {
case err != nil:
return false
case fi.IsDir():
testInventory := filepath.Join(path, "hosts")
if _, err := os.Stat(testInventory); os.IsNotExist(err) {
return false
}
return true
default:
return false
}
}
// if the user specifies an environment we will attempt to ensure that
// it exists, we will also set the inventory arg to be passed onto ansible.
func configureEnvironment(options *Options) error {
if options.Environment != "" {
if isEnvironment(options.Environment) {
options.Inventory = filepath.Join(options.Environment, "hosts")
} else {
return fmt.Errorf("%s is not a valid environment path", options.Environment)
}
} else {
cwd, _ := os.Getwd()
fmt.Printf("--environment not set. Trying your working directory (%s)\n", cwd)
if isEnvironment(cwd) {
options.Environment = cwd
options.Inventory = filepath.Join(cwd, "hosts")
} else {
return fmt.Errorf("%s is not a valid environment path", cwd)
}
}
if options.Inventory != "" {
if _, err := os.Stat(options.Inventory); os.IsNotExist(err) {
return fmt.Errorf("inventory file %s does not exist", options.Inventory)
}
}
return nil
}
// checks if the user specifies an alternative known hosts file, if not
// looks for one in the specified environment or just defaults to none.
func configureKnownHostsFile(options *Options) error {
if options.KnownHostsFile != "" {
if _, err := os.Stat(options.KnownHostsFile); os.IsNotExist(err) {
return fmt.Errorf("known hosts file %s does not exist", options.KnownHostsFile)
}
} else {
maybeKnownHostsFile := filepath.Join(options.Environment, "ssh_known_hosts")
if _, err := os.Stat(maybeKnownHostsFile); !os.IsNotExist(err) {
options.KnownHostsFile = maybeKnownHostsFile
}
}
if options.KnownHostsFile != "" {
appendEnvironmentVariable("ANSIBLE_SSH_ARGS",
fmt.Sprintf("-o UserKnownHostsFile=%s", options.KnownHostsFile))
}
return nil
}
// enables ssh agent forwarding
func configureSSHForwardAgent(options *Options) {
if options.SSHForwardAgent {
appendEnvironmentVariable("ANSIBLE_SSH_ARGS", "-o ForwardAgent=yes")
}
}
func init() {
// setEnvironmentVariables("ANSIBLE_STDOUT_CALLBACK","json")
}
func checkBinInPath(binary string) string {
fmt.Printf("==> checkBinInPath: %s\n", binary)
location, err := exec.LookPath(binary)
if err != nil {
fmt.Printf("==> checkBinInPath: err: %s\n", err)
return ""
}
return location
}
// runCmd takes a command and args and runs it, streaming output to stdout
func runCmd(cmdName string, cmdArgs []string) error {
fmt.Printf("==> Running: %s %s\n", cmdName, strings.Join(cmdArgs, " "))
//return fmt.Errorf("bye")
cmd := exec.Command(cmdName, cmdArgs...)
cmdReader, err := cmd.StdoutPipe()
if err != nil {
return err
}
scanner := bufio.NewScanner(cmdReader)
go func() {
for scanner.Scan() {
fmt.Printf("%s\n", scanner.Text())
}
}()
err = cmd.Start()
if err != nil {
return err
}
err = cmd.Wait()
if err != nil {
return err
}
return nil
}
-74
View File
@@ -1,74 +0,0 @@
/*
Copyright NetFoundry Inc.
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 ansible
import (
"fmt"
)
// ModuleOptions for running ansible
type ModuleOptions struct {
ModuleHosts string
Module string
ModulePath string
ModuleArgs string
}
// Module ansible playbook
func Module(options *Options, ansibleArgs []string) error {
var (
err error
zitiArgs []string
)
err = configureEnvironment(options)
if err != nil {
return err
}
err = sshConfigFile(options)
if err != nil {
return err
}
err = configureKnownHostsFile(options)
if err != nil {
return err
}
configureSSHForwardAgent(options)
zitiArgs = []string{options.ModuleHosts, "--module-name", options.Module}
if options.ModulePath != "" {
zitiArgs = append(zitiArgs,
[]string{"--module-path", options.ModulePath}...)
}
if options.ModuleArgs != "" {
zitiArgs = append(zitiArgs,
[]string{"--args", fmt.Sprintf("'%s'", options.ModuleArgs)}...)
}
if options.Inventory != "" {
zitiArgs = append(zitiArgs,
[]string{"--inventory", options.Inventory}...)
}
cmdName := "ansible"
cmdArgs := append(zitiArgs, ansibleArgs...)
return runCmd(cmdName, cmdArgs)
}
-59
View File
@@ -1,59 +0,0 @@
/*
Copyright NetFoundry Inc.
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 ansible
import (
// "fmt"
// "strings"
)
// PlaybookOptions for running ansible
type PlaybookOptions struct {
}
// PlaybookRun ansible playbook
func PlaybookRun(options *Options, ansibleArgs []string) error {
var (
err error
zitiArgs []string
)
err = configureEnvironment(options)
if err != nil {
return err
}
err = sshConfigFile(options)
if err != nil {
return err
}
err = configureKnownHostsFile(options)
if err != nil {
return err
}
configureSSHForwardAgent(options)
if options.Inventory != "" {
zitiArgs = append(zitiArgs,
[]string{"--inventory", options.Inventory}...)
}
cmdName := "ansible-playbook"
cmdArgs := append(zitiArgs, ansibleArgs...)
// fmt.Println("running: ansible_playbook", strings.Join(cmdArgs, " "))
return runCmd(cmdName, cmdArgs)
}
@@ -1,30 +1,18 @@
/*
Copyright NetFoundry Inc.
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 cmd
package agentcli
import (
"github.com/openziti/agent"
"github.com/openziti/channel/v2"
"github.com/openziti/edge/router/debugops"
"github.com/openziti/fabric/controller"
"github.com/openziti/fabric/pb/mgmt_pb"
"github.com/openziti/fabric/router"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/identity"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
"net"
"time"
)
type AgentAppId byte
@@ -35,7 +23,27 @@ const (
)
func NewAgentCmd(p common.OptionsProvider) *cobra.Command {
agentCmd := agentcli.NewAgentCmd(p)
agentCmd := &cobra.Command{
Use: "agent",
Short: "Interact with ziti processes using the the IPC agent",
Run: func(cmd *cobra.Command, args []string) {
cmdhelper.CheckErr(cmd.Help())
},
}
agentCmd.AddCommand(NewPsCmd(p))
agentCmd.AddCommand(NewGoVersionCmd(p))
agentCmd.AddCommand(NewGcCmd(p))
agentCmd.AddCommand(NewSetGcCmd(p))
agentCmd.AddCommand(NewStackCmd(p))
agentCmd.AddCommand(NewMemstatsCmd(p))
agentCmd.AddCommand(NewStatsCmd(p))
agentCmd.AddCommand(NewPprofHeapCmd(p))
agentCmd.AddCommand(NewPprofCpuCmd(p))
agentCmd.AddCommand(NewTraceCmd(p))
agentCmd.AddCommand(NewSetLogLevelCmd(p))
agentCmd.AddCommand(NewSetChannelLogLevelCmd(p))
agentCmd.AddCommand(NewClearChannelLogLevelCmd(p))
ctrlCmd := &cobra.Command{
Use: "controller",
@@ -73,3 +81,25 @@ func NewAgentCmd(p common.OptionsProvider) *cobra.Command {
return agentCmd
}
// AgentOptions contains the command line options
type AgentOptions struct {
common.CommonOptions
}
func NewAgentChannel(conn net.Conn) (channel.Channel, error) {
options := channel.DefaultOptions()
options.ConnectTimeout = time.Second
dialer := channel.NewExistingConnDialer(&identity.TokenId{Token: "agent"}, conn, nil)
return channel.NewChannel("agent", dialer, nil, options)
}
func MakeAgentChannelRequest(addr string, signal byte, params []byte, f func(ch channel.Channel) error) error {
return agent.MakeRequestF(addr, signal, params, func(conn net.Conn) error {
ch, err := NewAgentChannel(conn)
if err != nil {
return err
}
return f(ch)
})
}
@@ -14,29 +14,28 @@
limitations under the License.
*/
package cmd
package agentcli
import (
"fmt"
"github.com/openziti/channel/v2"
"github.com/openziti/agent"
"github.com/openziti/channel/v2"
"github.com/openziti/identity"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
"net"
"time"
)
type SimpleChAgentCmdOptions struct {
agentcli.AgentOptions
AgentOptions
requestType int32
}
func NewSimpleChAgentCustomCmd(name string, appId AgentAppId, op int32, p common.OptionsProvider) *cobra.Command {
options := &SimpleChAgentCmdOptions{
AgentOptions: agentcli.AgentOptions{
AgentOptions: AgentOptions{
CommonOptions: p(),
},
requestType: op,
@@ -20,8 +20,8 @@ import (
"bytes"
"encoding/binary"
"github.com/openziti/agent"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
"os"
)
@@ -14,7 +14,7 @@
limitations under the License.
*/
package cmd
package agentcli
import (
"fmt"
@@ -23,21 +23,20 @@ import (
"github.com/openziti/channel/v2/protobufs"
"github.com/openziti/edge/pb/edge_mgmt_pb"
"github.com/openziti/identity"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
"net"
"time"
)
type AgentCtrlInitOptions struct {
agentcli.AgentOptions
AgentOptions
}
func NewAgentCtrlInit(p common.OptionsProvider) *cobra.Command {
options := &AgentCtrlInitOptions{
AgentOptions: agentcli.AgentOptions{
AgentOptions: AgentOptions{
CommonOptions: p(),
},
}
@@ -14,7 +14,7 @@
limitations under the License.
*/
package cmd
package agentcli
import (
"fmt"
@@ -23,23 +23,22 @@ import (
"github.com/openziti/fabric/controller"
"github.com/openziti/fabric/pb/mgmt_pb"
"github.com/openziti/identity"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
"net"
"time"
)
type AgentCtrlRaftJoinOptions struct {
agentcli.AgentOptions
AgentOptions
Voter bool
MemberId string
}
func NewAgentCtrlRaftJoin(p common.OptionsProvider) *cobra.Command {
options := &AgentCtrlRaftJoinOptions{
AgentOptions: agentcli.AgentOptions{
AgentOptions: AgentOptions{
CommonOptions: p(),
},
}
@@ -14,30 +14,29 @@
limitations under the License.
*/
package cmd
package agentcli
import (
"fmt"
"github.com/golang/protobuf/proto"
"github.com/openziti/agent"
"github.com/openziti/channel/v2"
"github.com/openziti/fabric/pb/mgmt_pb"
"github.com/openziti/agent"
"github.com/openziti/identity"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
"net"
"time"
)
type AgentCtrlRaftListOptions struct {
agentcli.AgentOptions
AgentOptions
}
func NewAgentCtrlRaftList(p common.OptionsProvider) *cobra.Command {
options := &AgentCtrlRaftListOptions{
AgentOptions: agentcli.AgentOptions{
AgentOptions: AgentOptions{
CommonOptions: p(),
},
}
@@ -18,8 +18,8 @@ package agentcli
import (
"github.com/openziti/agent"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
"os"
)
@@ -18,14 +18,13 @@ package agentcli
import (
"fmt"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/internal/log"
"strconv"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
"github.com/shirou/gopsutil/v3/process"
"github.com/spf13/cobra"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/internal/log"
)
type AgentGetOptionsAction struct {
@@ -18,8 +18,8 @@ package agentcli
import (
"github.com/openziti/agent"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
"os"
)
@@ -18,8 +18,8 @@ package agentcli
import (
"github.com/openziti/agent"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
"os"
)
@@ -18,8 +18,8 @@ package agentcli
import (
"github.com/openziti/agent"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
"io"
"os"
@@ -18,8 +18,8 @@ package agentcli
import (
"github.com/openziti/agent"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
"io"
"os"
+261
View File
@@ -0,0 +1,261 @@
/*
Copyright NetFoundry Inc.
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 agentcli
import (
"bytes"
"fmt"
"github.com/keybase/go-ps"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"os"
"os/user"
"path/filepath"
"regexp"
goversion "rsc.io/goversion/version"
"runtime"
"strconv"
"strings"
"sync"
)
type AgentPsAction struct {
AgentOptions
}
// NewPsCmd Pss a command object for the "Ps" command
func NewPsCmd(p common.OptionsProvider) *cobra.Command {
action := &AgentPsAction{
AgentOptions: AgentOptions{
CommonOptions: p(),
},
}
cmd := &cobra.Command{
Use: "ps",
Short: "Show Ziti process info",
Long: "Show information about currently running Ziti processes",
Run: func(cmd *cobra.Command, args []string) {
action.Cmd = cmd
action.Args = args
err := action.Run()
cmdhelper.CheckErr(err)
},
}
return cmd
}
// Run implements this command
func (self *AgentPsAction) Run() error {
fmt.Println("ps is running")
ps := FindAll()
var maxPID, maxPPID, maxExec, maxVersion int
for i, p := range ps {
fmt.Println("p.Path is: " + p.Path)
ps[i].BuildVersion = shortenVersion(p.BuildVersion)
maxPID = max(maxPID, len(strconv.Itoa(p.PID)))
maxPPID = max(maxPPID, len(strconv.Itoa(p.PPID)))
maxExec = max(maxExec, len(p.Exec))
maxVersion = max(maxVersion, len(ps[i].BuildVersion))
}
for _, p := range ps {
buf := bytes.NewBuffer(nil)
pid := strconv.Itoa(p.PID)
fmt.Fprint(buf, pad(pid, maxPID))
fmt.Fprint(buf, " ")
ppid := strconv.Itoa(p.PPID)
fmt.Fprint(buf, pad(ppid, maxPPID))
fmt.Fprint(buf, " ")
fmt.Fprint(buf, pad(p.Exec, maxExec))
if p.Agent {
fmt.Fprint(buf, "*")
} else {
fmt.Fprint(buf, " ")
}
fmt.Fprint(buf, " ")
fmt.Fprint(buf, pad(p.BuildVersion, maxVersion))
fmt.Fprint(buf, " ")
fmt.Fprint(buf, p.Path)
fmt.Fprintln(buf)
buf.WriteTo(os.Stdout)
}
return nil
}
var develRe = regexp.MustCompile(`devel\s+\+\w+`)
func shortenVersion(v string) string {
if !strings.HasPrefix(v, "devel") {
return v
}
results := develRe.FindAllString(v, 1)
if len(results) == 0 {
return v
}
return results[0]
}
func pad(s string, total int) string {
if len(s) >= total {
return s
}
return s + strings.Repeat(" ", total-len(s))
}
func max(i, j int) int {
if i > j {
return i
}
return j
}
// P represents a Go process.
type P struct {
PID int
PPID int
Exec string
Path string
BuildVersion string
Agent bool
}
// FindAll returns all the Ziti processes currently running on this host.
func FindAll() []P {
pss, err := ps.Processes()
// fmt.Println("FindAll, err is: %s", err)
if err != nil {
return nil
}
var wg sync.WaitGroup
wg.Add(len(pss))
found := make(chan P)
for _, pr := range pss {
pr := pr
go func() {
defer wg.Done()
path, version, agent, ok, err := isGo(pr)
if err != nil {
// TODO(jbd): Return a list of errors.
}
if !ok {
return
}
if isZiti(pr) {
found <- P{
PID: pr.Pid(),
PPID: pr.PPid(),
Exec: pr.Executable(),
Path: path,
BuildVersion: version,
Agent: agent,
}
}
}()
}
go func() {
wg.Wait()
close(found)
}()
var results []P
for p := range found {
results = append(results, p)
}
return results
}
// isGo looks up the runtime.buildVersion symbol
// in the process' binary and determines if the process
// if a Go process or not. If the process is a Go process,
// it reports PID, binary name and full path of the binary.
func isGo(pr ps.Process) (path, version string, agent, ok bool, err error) {
if pr.Pid() == 0 {
// ignore system process
return
}
path, err = pr.Path()
if err != nil {
return
}
var versionInfo goversion.Version
versionInfo, err = goversion.ReadExe(path)
if err != nil {
return
}
ok = true
version = versionInfo.Release
pidfile, err := PIDFile(pr.Pid())
if err == nil {
_, err := os.Stat(pidfile)
agent = err == nil
}
return path, version, agent, ok, nil
}
const gopsConfigDirEnvKey = "GOPS_CONFIG_DIR"
func ConfigDir() (string, error) {
if configDir := os.Getenv(gopsConfigDirEnvKey); configDir != "" {
return configDir, nil
}
if runtime.GOOS == "windows" {
return filepath.Join(os.Getenv("APPDATA"), "gops"), nil
}
homeDir := guessUnixHomeDir()
if homeDir == "" {
return "", errors.New("unable to get current user home directory: os/user lookup failed; $HOME is empty")
}
return filepath.Join(homeDir, ".config", "gops"), nil
}
func guessUnixHomeDir() string {
usr, err := user.Current()
if err == nil {
return usr.HomeDir
}
return os.Getenv("HOME")
}
func PIDFile(pid int) (string, error) {
gopsdir, err := ConfigDir()
if err != nil {
return "", err
}
return fmt.Sprintf("%s/%d", gopsdir, pid), nil
}
func isZiti(pr ps.Process) (ok bool) {
return strings.HasPrefix(pr.Executable(), "ziti")
}
@@ -14,29 +14,28 @@
limitations under the License.
*/
package cmd
package agentcli
import (
"encoding/binary"
"google.golang.org/protobuf/proto"
"github.com/openziti/agent"
"github.com/openziti/fabric/pb/ctrl_pb"
"github.com/openziti/fabric/router"
"github.com/openziti/agent"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
"google.golang.org/protobuf/proto"
"os"
)
type AgentRouteAction struct {
agentcli.AgentOptions
AgentOptions
CtrlListener string
}
func NewRouteCmd(p common.OptionsProvider) *cobra.Command {
options := &AgentRouteAction{
AgentOptions: agentcli.AgentOptions{
AgentOptions: AgentOptions{
CommonOptions: p(),
},
}
@@ -14,30 +14,29 @@
limitations under the License.
*/
package cmd
package agentcli
import (
"fmt"
"github.com/openziti/agent"
"github.com/openziti/channel/v2"
"github.com/openziti/fabric/pb/mgmt_pb"
"github.com/openziti/fabric/router"
"github.com/openziti/agent"
"github.com/openziti/identity"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
"net"
"time"
)
type ForgetLinkAgentAction struct {
agentcli.AgentOptions
AgentOptions
}
func NewForgetLinkAgentCmd(p common.OptionsProvider) *cobra.Command {
options := &ForgetLinkAgentAction{
AgentOptions: agentcli.AgentOptions{
AgentOptions: AgentOptions{
CommonOptions: p(),
},
}
@@ -20,8 +20,8 @@ import (
"bytes"
"encoding/binary"
"github.com/openziti/agent"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@@ -18,8 +18,8 @@ package agentcli
import (
"github.com/openziti/agent"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@@ -19,8 +19,8 @@ package agentcli
import (
"encoding/binary"
"github.com/openziti/agent"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
"os"
"strconv"
@@ -14,24 +14,23 @@
limitations under the License.
*/
package cmd
package agentcli
import (
"github.com/openziti/agent"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
"os"
)
type SimpleAgentAction struct {
agentcli.AgentOptions
AgentOptions
}
func NewSimpleAgentCustomCmd(name string, appId AgentAppId, op byte, p common.OptionsProvider) *cobra.Command {
action := &SimpleAgentAction{
AgentOptions: agentcli.AgentOptions{
AgentOptions: AgentOptions{
CommonOptions: p(),
},
}
@@ -18,8 +18,8 @@ package agentcli
import (
"github.com/openziti/agent"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
"os"
"time"
@@ -18,8 +18,8 @@ package agentcli
import (
"github.com/openziti/agent"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
"os"
)
@@ -18,8 +18,8 @@ package agentcli
import (
"github.com/openziti/agent"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
"os"
)
@@ -19,7 +19,7 @@ package api
import (
"github.com/fatih/color"
"github.com/openziti/storage/boltz"
"github.com/openziti/ziti/ziti/cmd/ziti/util"
"github.com/openziti/ziti/ziti/util"
"net/url"
"strings"
)
@@ -21,7 +21,7 @@ import (
"github.com/Jeffail/gabs"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/openziti/foundation/v2/errorz"
"github.com/openziti/ziti/ziti/cmd/ziti/util"
"github.com/openziti/ziti/ziti/util"
"github.com/pkg/errors"
"io"
"net/url"
@@ -19,7 +19,7 @@ package api
import (
"fmt"
"github.com/Jeffail/gabs"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
"github.com/openziti/ziti/ziti/cmd/common"
"github.com/spf13/cobra"
"io"
)
@@ -23,7 +23,7 @@ import (
"github.com/openziti/channel/v2"
"github.com/openziti/channel/v2/websockets"
"github.com/openziti/identity"
"github.com/openziti/ziti/ziti/cmd/ziti/util"
"github.com/openziti/ziti/ziti/util"
"io"
"net/http"
"strings"
+5 -5
View File
@@ -17,11 +17,10 @@
package cmd
import (
"github.com/openziti/ziti/ziti/cmd/ziti/internal/log"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/internal/log"
"io"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/spf13/cobra"
)
@@ -40,8 +39,9 @@ func NewCmdArt(out io.Writer, errOut io.Writer) *cobra.Command {
}
cmd := &cobra.Command{
Use: "art",
Short: "Print the Ziti logo as ascii art :)",
Use: "art",
Short: "Print the Ziti logo as ascii art :)",
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
options.Cmd = cmd
options.Args = args
+45 -38
View File
@@ -19,25 +19,27 @@ package cmd
import (
goflag "flag"
"fmt"
"github.com/openziti/ziti/ziti/cmd/agentcli"
"github.com/openziti/ziti/ziti/cmd/common"
"github.com/openziti/ziti/ziti/cmd/database"
"github.com/openziti/ziti/ziti/cmd/demo"
"github.com/openziti/ziti/ziti/cmd/edge"
"github.com/openziti/ziti/ziti/cmd/fabric"
"github.com/openziti/ziti/ziti/cmd/install"
"github.com/openziti/ziti/ziti/cmd/templates"
"github.com/openziti/ziti/ziti/cmd/tutorial"
c "github.com/openziti/ziti/ziti/constants"
"github.com/openziti/ziti/ziti/controller"
"github.com/openziti/ziti/ziti/internal/log"
"github.com/openziti/ziti/ziti/router"
"github.com/openziti/ziti/ziti/tunnel"
"github.com/openziti/ziti/ziti/util"
"io"
"os"
"path/filepath"
"strings"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/database"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/demo"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/fabric"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/edge"
c "github.com/openziti/ziti/ziti/cmd/ziti/constants"
"github.com/openziti/ziti/ziti/cmd/ziti/internal/log"
"github.com/openziti/ziti/ziti/cmd/ziti/util"
"github.com/openziti/ziti/common/version"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
@@ -121,25 +123,39 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com
p := common.NewOptionsProvider(out, err)
initCommands := NewCmdInit(out, err)
createCommands := NewCmdCreate(out, err)
updateCommands := NewCmdUpdate(out, err)
executeCommands := NewCmdExecute(out, err)
agentCommands := NewAgentCmd(p)
psCommands := NewCmdPs(p)
controllerCmd := controller.NewControllerCmd()
tunnelCmd := tunnel.NewTunnelCmd(false)
routerCmd := router.NewRouterCmd()
agentCommands := agentcli.NewAgentCmd(p)
pkiCommands := NewCmdPKI(out, err)
fabricCommand := fabric.NewFabricCmd(p)
edgeCommand := edge.NewCmdEdge(out, err)
tutorialCmd := tutorial.NewTutorialCmd(p)
demoCmd := demo.NewDemoCmd(p)
logFilter := NewCmdLogFormat(out, err)
unwrapIdentityFileCommand := NewUnwrapIdentityFileCommand(out, err)
dbCommand := database.NewCmdDb(out, err)
opsCommands := &cobra.Command{
Use: "ops ",
Short: "Various utilities useful when operating a Ziti network",
}
opsCommands.AddCommand(database.NewCmdDb(out, err))
opsCommands.AddCommand(NewCmdLogFormat(out, err))
opsCommands.AddCommand(NewUnwrapIdentityFileCommand(out, err))
learnCommands := &cobra.Command{
Use: "learn ",
Short: "Tutorials and demos to help you learn about Ziti",
}
learnCommands.AddCommand(demoCmd)
learnCommands.AddCommand(tutorialCmd)
installCommands := []*cobra.Command{
NewCmdInstall(out, err),
NewCmdUnInstall(out, err),
NewCmdUpgrade(out, err),
install.NewCmdInstall(out, err),
install.NewCmdUpgrade(out, err),
install.NewCmdUse(out, err),
install.NewCmdVersion(out, err),
}
groups := templates.CommandGroups{
@@ -150,19 +166,17 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com
{
Message: "Working with Ziti resources:",
Commands: []*cobra.Command{
initCommands,
createCommands,
updateCommands,
},
},
{
Message: "Executing Ziti components:",
Commands: []*cobra.Command{
executeCommands,
agentCommands,
psCommands,
controllerCmd,
routerCmd,
tunnelCmd,
pkiCommands,
unwrapIdentityFileCommand,
},
},
{
@@ -175,29 +189,22 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com
{
Message: "Utilities",
Commands: []*cobra.Command{
logFilter,
dbCommand,
opsCommands,
},
},
{
Message: "Learning Ziti",
Commands: []*cobra.Command{
demoCmd,
tutorialCmd,
learnCommands,
},
},
}
groups.Add(cmd)
cmd.AddCommand(NewCmdVersion(out, err))
cmd.Version = version.GetVersion()
cmd.SetVersionTemplate("{{printf .Version}}\n")
cmd.AddCommand(NewCmdArt(out, err))
cmd.AddCommand(NewCmdPlaybook(out, err))
cmd.AddCommand(NewCmdPing(out, err))
cmd.AddCommand(NewCmdAdhoc(out, err))
cmd.AddCommand(NewCmdUse(out, err))
return cmd
}
@@ -17,8 +17,8 @@
package color
import (
"github.com/openziti/ziti/ziti/cmd/ziti/util"
"github.com/fatih/color"
"github.com/openziti/ziti/ziti/util"
"sort"
)
@@ -54,6 +54,15 @@ type CommonOptions struct {
Identity string
}
func (options *CommonOptions) AddCommonFlags(cmd *cobra.Command) {
cmd.Flags().BoolVarP(&options.BatchMode, "batch-mode", "b", false, "In batch mode the command never prompts for user input")
cmd.Flags().BoolVarP(&options.Verbose, "verbose", "", false, "Enable verbose logging")
cmd.Flags().BoolVarP(&options.Staging, "staging", "", false, "Install/Upgrade components from the ziti-staging repo")
cmd.Flags().StringVarP(&options.ConfigIdentity, "configIdentity", "i", "", "Which configIdentity to use")
cmd.Flags().IntVarP(&options.Timeout, "timeout", "t", 5, "Timeout for REST operations (specified in seconds)")
options.Cmd = cmd
}
func (options *CommonOptions) TimeoutContext() (context.Context, context.CancelFunc) {
timeout := time.Duration(options.Timeout) * time.Second
@@ -18,13 +18,12 @@ package cmd
import (
"fmt"
"github.com/openziti/ziti/ziti/internal/log"
"github.com/openziti/ziti/ziti/util"
"io/ioutil"
"os"
"os/exec"
"strings"
"github.com/openziti/ziti/ziti/cmd/ziti/internal/log"
"github.com/openziti/ziti/ziti/cmd/ziti/util"
)
var cliAgentEnabled bool
@@ -18,8 +18,8 @@ package cmd
import (
"fmt"
c "github.com/openziti/ziti/ziti/cmd/ziti/constants"
"github.com/openziti/ziti/ziti/cmd/ziti/util"
c "github.com/openziti/ziti/ziti/constants"
"github.com/openziti/ziti/ziti/util"
"github.com/spf13/viper"
"gopkg.in/AlecAivazis/survey.v1"
"os"
@@ -17,7 +17,7 @@
package cmd
import (
c "github.com/openziti/ziti/ziti/cmd/ziti/constants"
c "github.com/openziti/ziti/ziti/constants"
"github.com/pborman/uuid"
"github.com/stretchr/testify/assert"
"os"
@@ -17,11 +17,10 @@
package cmd
import (
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/templates"
"github.com/spf13/cobra"
"io"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates"
)
var (
@@ -43,7 +42,6 @@ func NewCmdCreate(out io.Writer, errOut io.Writer) *cobra.Command {
}
cmd.AddCommand(NewCmdCreateConfig())
cmd.AddCommand(NewCmdCreateEnvironment(out, errOut))
cmd.AddCommand(NewCmdPKICreateCA(out, errOut))
cmd.AddCommand(NewCmdPKICreateIntermediate(out, errOut))
@@ -17,6 +17,9 @@
package cmd
import (
"github.com/openziti/ziti/ziti/cmd/common"
helpers2 "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/constants"
"os"
"time"
@@ -26,9 +29,6 @@ import (
fabForwarder "github.com/openziti/fabric/router/forwarder"
foundation "github.com/openziti/transport/v2"
fabXweb "github.com/openziti/xweb/v2"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/constants"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
@@ -179,7 +179,7 @@ func init() {
}
}
workingDir = cmdhelper.NormalizePath(zh)
workingDir = helpers2.NormalizePath(zh)
}
// NewCmdCreateConfig creates a command object for the "config" command
@@ -189,7 +189,7 @@ func NewCmdCreateConfig() *cobra.Command {
Short: "Creates a config file for specified Ziti component using environment variables",
Aliases: []string{"cfg"},
Run: func(cmd *cobra.Command, args []string) {
cmdhelper.CheckErr(cmd.Help())
helpers2.CheckErr(cmd.Help())
},
}
@@ -213,47 +213,47 @@ func (data *ConfigTemplateValues) populateEnvVars() {
handleVariableError(err, "hostname")
// Get and add ziti home to the params
zitiHome, err := cmdhelper.GetZitiHome()
zitiHome, err := helpers2.GetZitiHome()
handleVariableError(err, constants.ZitiHomeVarName)
// Get Ziti Controller Name
zitiCtrlHostname, err := cmdhelper.GetZitiCtrlName()
zitiCtrlHostname, err := helpers2.GetZitiCtrlName()
handleVariableError(err, constants.ZitiCtrlNameVarName)
// Get Ziti Edge Router Port
zitiEdgeRouterPort, err := cmdhelper.GetZitiEdgeRouterPort()
zitiEdgeRouterPort, err := helpers2.GetZitiEdgeRouterPort()
handleVariableError(err, constants.ZitiEdgeRouterPortVarName)
// Get Ziti Controller Listener Address
zitiCtrlListenerAddress, err := cmdhelper.GetZitiCtrlListenerAddress()
zitiCtrlListenerAddress, err := helpers2.GetZitiCtrlListenerAddress()
handleVariableError(err, constants.ZitiCtrlListenerAddressVarName)
// Get Ziti Controller Advertised Address
zitiCtrlAdvertisedAddress, err := cmdhelper.GetZitiCtrlAdvertisedAddress()
zitiCtrlAdvertisedAddress, err := helpers2.GetZitiCtrlAdvertisedAddress()
handleVariableError(err, constants.ZitiCtrlAdvertisedAddressVarName)
// Get Ziti Controller Port
zitiCtrlPort, err := cmdhelper.GetZitiCtrlPort()
zitiCtrlPort, err := helpers2.GetZitiCtrlPort()
handleVariableError(err, constants.ZitiCtrlPortVarName)
// Get Ziti Edge Controller Listener Host and Port
zitiEdgeCtrlListenerHostPort, err := cmdhelper.GetZitiEdgeCtrlListenerHostPort()
zitiEdgeCtrlListenerHostPort, err := helpers2.GetZitiEdgeCtrlListenerHostPort()
handleVariableError(err, constants.ZitiEdgeCtrlListenerHostPortVarName)
// Get Ziti Edge Controller Advertised Host and Port
zitiEdgeCtrlAdvertisedHostPort, err := cmdhelper.GetZitiEdgeCtrlAdvertisedHostPort()
zitiEdgeCtrlAdvertisedHostPort, err := helpers2.GetZitiEdgeCtrlAdvertisedHostPort()
handleVariableError(err, constants.ZitiEdgeCtrlAdvertisedHostPortVarName)
// Get Ziti Edge Controller Advertised Port
zitiEdgeCtrlAdvertisedPort, err := cmdhelper.GetZitiEdgeCtrlAdvertisedPort()
zitiEdgeCtrlAdvertisedPort, err := helpers2.GetZitiEdgeCtrlAdvertisedPort()
handleVariableError(err, constants.ZitiEdgeCtrlAdvertisedPortVarName)
// Get Ziti edge Identity enrollment duration
zitiEdgeIdentityEnrollmentDuration, err := cmdhelper.GetZitiEdgeIdentityEnrollmentDuration()
zitiEdgeIdentityEnrollmentDuration, err := helpers2.GetZitiEdgeIdentityEnrollmentDuration()
handleVariableError(err, constants.ZitiEdgeIdentityEnrollmentDurationVarName)
// Get Ziti edge Router enrollment duration
zitiEdgeRouterEnrollmentDuration, err := cmdhelper.GetZitiEdgeRouterEnrollmentDuration()
zitiEdgeRouterEnrollmentDuration, err := helpers2.GetZitiEdgeRouterEnrollmentDuration()
handleVariableError(err, constants.ZitiEdgeRouterEnrollmentDurationVarName)
data.ZitiHome = zitiHome
@@ -19,9 +19,9 @@ package cmd
import (
_ "embed"
edge "github.com/openziti/edge/controller/config"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates"
"github.com/openziti/ziti/ziti/cmd/ziti/constants"
helpers2 "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/templates"
"github.com/openziti/ziti/ziti/constants"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@@ -126,7 +126,7 @@ func NewCmdCreateConfigController() *cobra.Command {
controllerOptions.Cmd = cmd
controllerOptions.Args = args
err := controllerOptions.run(data)
cmdhelper.CheckErr(err)
helpers2.CheckErr(err)
},
PostRun: func(cmd *cobra.Command, args []string) {
// Reset log output after run completes
@@ -204,28 +204,28 @@ func SetControllerIdentityCert(c *ControllerTemplateValues) {
if val == "" {
val = workingDir + "/" + hostnameOrNetworkName() + ".cert" // default
}
c.IdentityCert = cmdhelper.NormalizePath(val)
c.IdentityCert = helpers2.NormalizePath(val)
}
func SetControllerIdentityServerCert(c *ControllerTemplateValues) {
val := os.Getenv(constants.ZitiCtrlIdentityServerCertVarName)
if val == "" {
val = workingDir + "/" + hostnameOrNetworkName() + ".server.chain.cert" // default
}
c.IdentityServerCert = cmdhelper.NormalizePath(val)
c.IdentityServerCert = helpers2.NormalizePath(val)
}
func SetControllerIdentityKey(c *ControllerTemplateValues) {
val := os.Getenv(constants.ZitiCtrlIdentityKeyVarName)
if val == "" {
val = workingDir + "/" + hostnameOrNetworkName() + ".key" // default
}
c.IdentityKey = cmdhelper.NormalizePath(val)
c.IdentityKey = helpers2.NormalizePath(val)
}
func SetControllerIdentityCA(c *ControllerTemplateValues) {
val := os.Getenv(constants.ZitiCtrlIdentityCAVarName)
if val == "" {
val = workingDir + "/" + hostnameOrNetworkName() + ".ca" // default
}
c.IdentityCA = cmdhelper.NormalizePath(val)
c.IdentityCA = helpers2.NormalizePath(val)
}
func SetEdgeConfig(data *ControllerTemplateValues) {
@@ -237,14 +237,14 @@ func SetEdgeSigningCert(c *ControllerTemplateValues) {
if val == "" {
val = workingDir + "/" + hostnameOrNetworkName() + ".signing.cert" // default
}
c.Edge.ZitiSigningCert = cmdhelper.NormalizePath(val)
c.Edge.ZitiSigningCert = helpers2.NormalizePath(val)
}
func SetEdgeSigningKey(c *ControllerTemplateValues) {
val := os.Getenv(constants.ZitiSigningKeyVarName)
if val == "" {
val = workingDir + "/" + hostnameOrNetworkName() + ".signing.key" // default
}
c.Edge.ZitiSigningKey = cmdhelper.NormalizePath(val)
c.Edge.ZitiSigningKey = helpers2.NormalizePath(val)
}
func SetWebConfig(data *ControllerTemplateValues) {
@@ -258,26 +258,26 @@ func SetWebIdentityCert(c *ControllerTemplateValues) {
if val == "" {
val = c.IdentityCert //default
}
c.Edge.IdentityCert = cmdhelper.NormalizePath(val)
c.Edge.IdentityCert = helpers2.NormalizePath(val)
}
func SetWebIdentityServerCert(c *ControllerTemplateValues) {
val := os.Getenv(constants.ZitiEdgeCtrlIdentityServerCertVarName)
if val == "" {
val = c.IdentityServerCert //default
}
c.Edge.IdentityServerCert = cmdhelper.NormalizePath(val)
c.Edge.IdentityServerCert = helpers2.NormalizePath(val)
}
func SetWebIdentityKey(c *ControllerTemplateValues) {
val := os.Getenv(constants.ZitiEdgeCtrlIdentityKeyVarName)
if val == "" {
val = c.IdentityKey //default
}
c.Edge.IdentityKey = cmdhelper.NormalizePath(val)
c.Edge.IdentityKey = helpers2.NormalizePath(val)
}
func SetWebIdentityCA(c *ControllerTemplateValues) {
val := os.Getenv(constants.ZitiEdgeCtrlIdentityCAVarName)
if val == "" {
val = c.IdentityCA //default
}
c.Edge.IdentityCA = cmdhelper.NormalizePath(val)
c.Edge.IdentityCA = helpers2.NormalizePath(val)
}
@@ -19,15 +19,15 @@ package cmd
import (
_ "embed"
"fmt"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/templates"
"github.com/openziti/ziti/ziti/constants"
"os"
"path/filepath"
"runtime"
"strings"
"text/template"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates"
"github.com/openziti/ziti/ziti/cmd/ziti/constants"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@@ -18,10 +18,10 @@ package cmd
import (
_ "embed"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"os"
"strings"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
@@ -18,11 +18,10 @@ package cmd
import (
_ "embed"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/constants"
"log"
"os"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/constants"
)
func SetZitiRouterIdentity(r *RouterTemplateValues, routerName string) {
@@ -18,13 +18,13 @@ package cmd
import (
_ "embed"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/templates"
"os"
"path/filepath"
"strings"
"text/template"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@@ -1,7 +1,7 @@
package cmd
import (
"github.com/openziti/ziti/ziti/cmd/ziti/constants"
"github.com/openziti/ziti/ziti/constants"
"github.com/stretchr/testify/assert"
"os"
"testing"
@@ -18,8 +18,8 @@ package cmd
import (
_ "embed"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/templates"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@@ -1,7 +1,7 @@
package cmd
import (
"github.com/openziti/ziti/ziti/cmd/ziti/constants"
"github.com/openziti/ziti/ziti/constants"
"github.com/stretchr/testify/assert"
"os"
"testing"
@@ -2,7 +2,7 @@ package cmd
import (
"fmt"
"github.com/openziti/ziti/ziti/cmd/ziti/constants"
"github.com/openziti/ziti/ziti/constants"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v3"
"os"
@@ -3,7 +3,7 @@ package database
import (
"fmt"
"github.com/openziti/ziti-db-explorer/cmd/ziti-db-explorer/zdecli"
"github.com/openziti/ziti/ziti/cmd/ziti/util"
"github.com/openziti/ziti/ziti/util"
"github.com/spf13/cobra"
"io"
)
@@ -20,8 +20,8 @@ import (
"bufio"
"fmt"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/channel/v2"
"github.com/openziti/agent"
"github.com/openziti/channel/v2"
"github.com/openziti/identity"
"github.com/openziti/sdk-golang/ziti"
"github.com/openziti/sdk-golang/ziti/config"
@@ -18,11 +18,11 @@ package demo
import (
"fmt"
"github.com/openziti/channel/v2"
"github.com/openziti/agent"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/channel/v2"
"github.com/openziti/ziti/ziti/cmd/agentcli"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"time"
@@ -17,9 +17,9 @@
package demo
import (
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/agentcli"
"github.com/openziti/ziti/ziti/cmd/common"
"github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/spf13/cobra"
)
@@ -20,10 +20,10 @@ import (
_ "embed"
"github.com/openziti/runzmd"
"github.com/openziti/runzmd/actionz"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/tutorial"
"github.com/spf13/cobra"
"time"
)
@@ -20,10 +20,10 @@ import (
_ "embed"
"github.com/openziti/runzmd"
"github.com/openziti/runzmd/actionz"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/tutorial"
"github.com/spf13/cobra"
"time"
)
@@ -20,10 +20,10 @@ import (
_ "embed"
"github.com/openziti/runzmd"
"github.com/openziti/runzmd/actionz"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/tutorial"
"github.com/spf13/cobra"
"time"
)
@@ -20,10 +20,10 @@ import (
_ "embed"
"github.com/openziti/runzmd"
"github.com/openziti/runzmd/actionz"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/tutorial"
"github.com/spf13/cobra"
"time"
)
@@ -20,10 +20,10 @@ import (
_ "embed"
"github.com/openziti/runzmd"
"github.com/openziti/runzmd/actionz"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/tutorial"
"github.com/spf13/cobra"
"time"
)
@@ -20,10 +20,10 @@ import (
_ "embed"
"github.com/openziti/runzmd"
"github.com/openziti/runzmd/actionz"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/tutorial"
"github.com/spf13/cobra"
"time"
)
@@ -20,10 +20,10 @@ import (
_ "embed"
"github.com/openziti/runzmd"
"github.com/openziti/runzmd/actionz"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/tutorial"
"github.com/spf13/cobra"
"time"
)
@@ -20,10 +20,10 @@ import (
_ "embed"
"github.com/openziti/runzmd"
"github.com/openziti/runzmd/actionz"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/tutorial"
"github.com/spf13/cobra"
"time"
)
@@ -20,10 +20,10 @@ import (
_ "embed"
"github.com/openziti/runzmd"
"github.com/openziti/runzmd/actionz"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/tutorial"
"github.com/spf13/cobra"
"time"
)
@@ -18,7 +18,7 @@ package edge
import (
"fmt"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/pkg/errors"
"os"
"strings"
@@ -18,11 +18,11 @@ package edge
import (
"github.com/Jeffail/gabs"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/ziti/util"
"github.com/openziti/ziti/ziti/cmd/api"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/util"
"io"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/spf13/cobra"
)
@@ -17,8 +17,8 @@
package edge
import (
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/common"
"github.com/spf13/cobra"
"io"
)
@@ -23,9 +23,9 @@ import (
"github.com/Jeffail/gabs"
"github.com/openziti/edge/rest_management_api_client/authenticator"
"github.com/openziti/foundation/v2/term"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/util"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/util"
"github.com/spf13/cobra"
)
@@ -20,10 +20,10 @@ import (
"fmt"
"github.com/openziti/edge/rest_management_api_client/certificate_authority"
"github.com/openziti/edge/rest_model"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/util"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/util"
"github.com/spf13/cobra"
"io"
"os"
@@ -19,15 +19,15 @@ package edge
import (
"encoding/json"
"fmt"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"io"
"io/ioutil"
"github.com/pkg/errors"
"github.com/Jeffail/gabs"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/spf13/cobra"
)
@@ -19,15 +19,15 @@ package edge
import (
"encoding/json"
"fmt"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"io"
"io/ioutil"
"github.com/pkg/errors"
"github.com/Jeffail/gabs"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/spf13/cobra"
)
@@ -18,14 +18,13 @@ package edge
import (
"fmt"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"io"
"io/ioutil"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/Jeffail/gabs"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/spf13/cobra"
)
@@ -17,12 +17,12 @@
package edge
import (
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"io"
"github.com/Jeffail/gabs"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/spf13/cobra"
)
@@ -22,10 +22,10 @@ import (
"github.com/go-openapi/strfmt"
"github.com/openziti/edge/rest_management_api_client/enrollment"
"github.com/openziti/edge/rest_model"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/cmd/ziti/util"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/util"
"github.com/spf13/cobra"
"io"
"time"
@@ -18,7 +18,9 @@ package edge
import (
"fmt"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/api"
"github.com/openziti/ziti/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/pkg/errors"
"io"
"io/ioutil"
@@ -27,8 +29,6 @@ import (
"strings"
"github.com/Jeffail/gabs"
"github.com/openziti/ziti/ziti/cmd/ziti/cmd/common"
cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
"github.com/spf13/cobra"
)

Some files were not shown because too many files have changed in this diff Show More