common

package
v0.0.0-...-fe6e0c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildFullSshCmd

func BuildFullSshCmd(sshCmd string, host string) (string, string, error)

func BuildSshConfigFile

func BuildSshConfigFile(inventoryFile string, sshConfigFile string, yaml bool, etc bool) error

func BuildSshConfigFileFromEtcHosts

func BuildSshConfigFileFromEtcHosts(etcHostsFile string, sshConfigFile string) error

func BuildSshConfigFileFromIni

func BuildSshConfigFileFromIni(inventoryFile string, sshConfigFile string) error

func BuildSshConfigFileFromYaml

func BuildSshConfigFileFromYaml(inventoryFile string, sshConfigFile string) error

func ConvertToString

func ConvertToString(value interface{}) string

func DetectType

func DetectType(value []byte) string

func ExecCmd

func ExecCmd(cmd string) ([]string, error)

Shell execution functions:

func ExecCmdSimple

func ExecCmdSimple(cmd string) (string, error)

func ExecComplexCmd

func ExecComplexCmd(cmd string) (string, error)

func FormatShellCommand

func FormatShellCommand(input string) []string

func GetNestedFieldValue

func GetNestedFieldValue(data interface{}, keyName string) interface{}

func IsIni

func IsIni(data []byte) bool

func IsJson

func IsJson(data []byte) bool

func IsYaml

func IsYaml(data []byte) bool

func SliceIndex

func SliceIndex(element string, data []string) int

func SnakeToCamel

func SnakeToCamel(s string) string

func StringInSlice

func StringInSlice(a string, list []string) bool

func TestEqualSlice

func TestEqualSlice(a []string, b []string) bool

func TestOCConnection

func TestOCConnection() bool

func TestSshConnection

func TestSshConnection(sshCmd string) bool

func ToLowerSlice

func ToLowerSlice(data []string) []string

Types

type AnsibleHostStruct

type AnsibleHostStruct struct {
	AnsibleHost              string `yaml:"ansible_ssh_host,omitempty"`
	AnsibleUser              string `yaml:"ansible_user,omitempty"`
	AnsiblePort              string `yaml:"ansible_port,omitempty"`
	AnsibleSSHPrivateKeyFile string `yaml:"ansible_ssh_private_key_file,omitempty"`
}

type Config

type Config struct {
	Services map[string]Service `yaml:"services"`
}

func LoadServiceConfigFile

func LoadServiceConfigFile(configPath string) (Config, error)

type Group

type Group struct {
	Hosts map[string]AnsibleHostStruct `yaml:"hosts"`
	Vars  map[string]interface{}       `yaml:"vars"`
}

type Host

type Host struct {
	Name                  string
	HostName              string
	IdentityFile          string
	Port                  string
	User                  string
	AdditionalLines       []string
	StrictHostKeyChecking string
	UserKnownHostsFile    string
}

Host structure for ssh config file

type Inventory

type Inventory map[string]Group

type ODConfig

type ODConfig struct {
	Default struct {
		LocalConfigDir    string `ini:"local_config_dir"`
		ServiceConfigFile string `ini:"service_config_file"`
	} `ini:"Default"`

	Tripleo struct {
		SshCmd           string `ini:"ssh_cmd"`
		DirectorHost     string `ini:"director_host"`
		ContainerEngine  string `ini:"container_engine"`
		Connection       string `ini:"connection"`
		RemoteConfigPath string `ini:"remote_config_path"`
		LocalConfigPath  string `ini:"local_config_path"`
	} `ini:"Tripleo"`

	Openshift struct {
		OcpLocalConfigPath string `ini:"ocp_local_config_path"`
		Connection         string `ini:"connection"`
	} `ini:"Openshift"`
}

OS Diff Config Structure

func LoadOSDiffConfig

func LoadOSDiffConfig(configFileName string) (*ODConfig, error)

type Service

type Service struct {
	Enable             bool              `yaml:"enable"`
	PodmanId           string            `yaml:"podman_id"`
	PodmanImage        string            `yaml:"podman_image"`
	PodmanName         string            `yaml:"podman_name"`
	PodName            string            `yaml:"pod_name"`
	ContainerName      string            `yaml:"container_name"`
	StrictPodNameMatch bool              `yaml:"strict_pod_name_match"`
	Path               []string          `yaml:"path"`
	Hosts              []string          `yaml:"hosts"`
	ServiceCommand     string            `yaml:"service_command"`
	CatOutput          bool              `yaml:"cat_output"`
	ConfigMapping      map[string]string `yaml:"config_mapping"`
}

Service YAML Config Structure

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL