options

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseChoosedComponents

func ParseChoosedComponents(zone *target.Zone, components []string, ansible bool, helm bool) (map[string]string, map[string]string, error)

func ParseComponentsOption

func ParseComponentsOption(componentsOptions []string) (map[string]string, error)

ParseComponentsOption parses --component options and interprets them as map of components.

eg options:

--component A                     # only specify componentName
--component B/v0.0.1              # specify componentName/componentVersion
--component C/v0.0.2,D/v0.0.3     # sepcify multiple components with comma separated
--component E/v1.2.3/831212f      # specify componentName/componentVersion/componentLongVersion

result:

{
  "A": "",
  "B": "v0.0.1",
  "C": "v0.0.2",
  "D": "v0.0.3",
  "E": "831212f"
}

func ParseHostsOptions

func ParseHostsOptions(hostsOptions []string) (map[string][]ansible.ActionHosts, error)

ParseHostsOptions parses --hosts options and interprets them as a map, key is component name, value is a list of ActionHosts. The returned map can be used to update cmdb inventory.

eg options:

--hosts A,B/10.0.0.1,10.0.0.2 --hosts +C/10.0.0.3,10.0.0.4 --hosts -C,D,E/10.0.0.4

result:

{
  "A": [
    { "Aciton": "update", "Hosts": ["10.0.0.1", "10.0.0.2"] },
  ],
  "B": [
    { "Aciton": "update", "Hosts": ["10.0.0.1", "10.0.0.2"] },
  ],
  "C": [
    { "Aciton": "add", "Hosts": ["10.0.0.3", "10.0.0.4"] },
    { "Aciton": "remove", "Hosts": ["10.0.0.4"] },
  ],
  "D": [
    { "Aciton": "remove", "Hosts": ["10.0.0.4"] },
  ],
  "E": [
    { "Aciton": "remove", "Hosts": ["10.0.0.4"] },
  ],
}

func PrintColorHeader

func PrintColorHeader(targetName string, zoneName string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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