Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAuth(user string, pass string, r *http.Request) bool
- func CheckSignature(rawSign string, pubPem []byte, data []byte) bool
- func ClientDistributionHandler(w http.ResponseWriter, req *http.Request)
- func ClientHostnameDistributionHandler(w http.ResponseWriter, req *http.Request)
- func ClientHostnameHandler(w http.ResponseWriter, req *http.Request)
- func CreateUser(saltMaster SaltMaster) (resp model.Response, err error)
- func DetermineBootstrapPort() int
- func Distribute(clients []string, payload []byte, endpoint string, user string, pass string) <-chan model.Response
- func DistributeFileUploadRequest(endpoint string, user string, pass string, targets []string, path string, ...) <-chan model.Response
- func DistributeRequest(clients []string, endpoint string, user string, pass string, signature string, ...) <-chan model.Response
- func ExecCmd(executable string, args ...string) (outStr string, err error)
- func FileUploadDistributeHandler(w http.ResponseWriter, req *http.Request)
- func FileUploadHandler(w http.ResponseWriter, req *http.Request)
- func GetAuthUserPass(r *http.Request) (string, string)
- func GetSignatureAndSigned(r *http.Request) (string, string)
- func HealthCheckHandler(w http.ResponseWriter, req *http.Request)
- func IsServiceRunning(service string) (bool, string)
- func LaunchService(service string) (model.Response, error)
- func NewCloudbreakBootstrapWeb()
- func RestartService(service string) (model.Response, error)
- func SaltActionDistributeRequestHandler(w http.ResponseWriter, req *http.Request)
- func SaltMinionRunRequestHandler(w http.ResponseWriter, req *http.Request)
- func SaltMinionStopRequestHandler(w http.ResponseWriter, req *http.Request)
- func SaltPillarDistributeRequestHandler(w http.ResponseWriter, req *http.Request)
- func SaltPillarRequestHandler(w http.ResponseWriter, req *http.Request)
- func SaltServerRunRequestHandler(w http.ResponseWriter, req *http.Request)
- func SaltServerStopRequestHandler(w http.ResponseWriter, req *http.Request)
- func ServerRequestHandler(w http.ResponseWriter, req *http.Request)
- func SetServiceState(service string, serviceAction string) (resp model.Response, err error)
- func StopService(service string) (model.Response, error)
- func Unzip(src, dest string) error
- type Authenticator
- type Clients
- type GrainConfig
- type InitSystem
- type SaltActionRequest
- type SaltAuth
- type SaltMaster
- type SaltMinion
- type SaltPillar
- type SecurityConfig
- type Server
- type Servers
- type SignatureMethod
Constants ¶
View Source
const ( SIGNED SignatureMethod = iota OPEN SIGNATURE = "signature" SIGNED_CONTENT = "signed" )
View Source
const ( ENV_TYPE = "SALT_BOOTSTRAP_ENV_TYPE" EXECUTED_COMMANDS = "EXECUTED_COMMANDS" )
View Source
const ( START_ACTION = "start" STOP_ACTION = "stop" RESTART_ACTION = "restart" )
View Source
const ( RootPath = "/saltboot" HealthEP = RootPath + "/health" ServerSaveEP = RootPath + "/server/save" ServerDistributeEP = RootPath + "/server/distribute" SaltActionDistributeEP = RootPath + "/salt/action/distribute" SaltMinionEp = RootPath + "/salt/minion" SaltServerEp = RootPath + "/salt/server" SaltMinionRunEP = SaltMinionEp + "/run" SaltMinionStopEP = SaltMinionEp + "/stop" SaltServerRunEP = SaltServerEp + "/run" SaltServerStopEP = SaltServerEp + "/stop" SaltPillarEP = RootPath + "/salt/server/pillar" SaltPillarDistributeEP = SaltPillarEP + "/distribute" HostnameDistributeEP = RootPath + "/hostname/distribute" HostnameEP = RootPath + "/hostname" UploadEP = RootPath + "/file" FileDistributeEP = UploadEP + "/distribute" )
View Source
const DEFAULT_DOMAIN = ".example.com"
View Source
const HOST_FILE_NAME = "/etc/hosts"
View Source
const SALT_USER = "saltuser"
Variables ¶
View Source
var ( SYSTEM_D = InitSystem{ActionBin: "/bin/systemctl", StateBin: "/bin/systemctl", Start: START_ACTION, Stop: STOP_ACTION, Restart: RESTART_ACTION, Enable: "enable", Disable: "disable", CommandOrderASC: true} SYS_V_INIT = InitSystem{ActionBin: "/sbin/service", StateBin: "/sbin/chkconfig", Start: START_ACTION, Stop: STOP_ACTION, Restart: RESTART_ACTION, Enable: "on", Disable: "off", CommandOrderASC: false} )
View Source
var ( Version string BuildTime string )
Functions ¶
func ClientDistributionHandler ¶
func ClientDistributionHandler(w http.ResponseWriter, req *http.Request)
func ClientHostnameDistributionHandler ¶
func ClientHostnameDistributionHandler(w http.ResponseWriter, req *http.Request)
func ClientHostnameHandler ¶
func ClientHostnameHandler(w http.ResponseWriter, req *http.Request)
func CreateUser ¶
func CreateUser(saltMaster SaltMaster) (resp model.Response, err error)
func DetermineBootstrapPort ¶
func DetermineBootstrapPort() int
func Distribute ¶
func DistributeFileUploadRequest ¶ added in v0.11.0
func DistributeRequest ¶ added in v0.11.0
func FileUploadDistributeHandler ¶ added in v0.11.0
func FileUploadDistributeHandler(w http.ResponseWriter, req *http.Request)
func FileUploadHandler ¶
func FileUploadHandler(w http.ResponseWriter, req *http.Request)
func GetSignatureAndSigned ¶ added in v0.10.2
func HealthCheckHandler ¶
func HealthCheckHandler(w http.ResponseWriter, req *http.Request)
func IsServiceRunning ¶ added in v0.11.1
func NewCloudbreakBootstrapWeb ¶
func NewCloudbreakBootstrapWeb()
func SaltActionDistributeRequestHandler ¶
func SaltActionDistributeRequestHandler(w http.ResponseWriter, req *http.Request)
func SaltMinionRunRequestHandler ¶
func SaltMinionRunRequestHandler(w http.ResponseWriter, req *http.Request)
func SaltMinionStopRequestHandler ¶
func SaltMinionStopRequestHandler(w http.ResponseWriter, req *http.Request)
func SaltPillarDistributeRequestHandler ¶ added in v0.11.0
func SaltPillarDistributeRequestHandler(w http.ResponseWriter, req *http.Request)
func SaltPillarRequestHandler ¶
func SaltPillarRequestHandler(w http.ResponseWriter, req *http.Request)
func SaltServerRunRequestHandler ¶
func SaltServerRunRequestHandler(w http.ResponseWriter, req *http.Request)
func SaltServerStopRequestHandler ¶
func SaltServerStopRequestHandler(w http.ResponseWriter, req *http.Request)
func ServerRequestHandler ¶
func ServerRequestHandler(w http.ResponseWriter, req *http.Request)
func SetServiceState ¶
Types ¶
type Authenticator ¶
func (*Authenticator) Wrap ¶
func (a *Authenticator) Wrap(handler func(w http.ResponseWriter, req *http.Request), signatureMethod SignatureMethod) http.Handler
type Clients ¶
type Clients struct { Clients []string `json:"clients,omitempty"` Servers []Server `json:"servers,omitempty"` Path string `json:"path"` }
func (*Clients) DistributeAddress ¶
type GrainConfig ¶
type InitSystem ¶
type InitSystem struct { Start string Stop string Restart string Enable string Disable string ActionBin string StateBin string CommandOrderASC bool }
func GetInitSystem ¶
func GetInitSystem(stat func(name string) (os.FileInfo, error)) (system InitSystem)
func (InitSystem) ActionCommand ¶
func (system InitSystem) ActionCommand(service string, action string) []string
func (InitSystem) Error ¶
func (system InitSystem) Error() string
func (InitSystem) StateCommand ¶
func (system InitSystem) StateCommand(service string, enable bool) []string
type SaltActionRequest ¶
type SaltActionRequest struct { Master SaltMaster `json:"master,omitempty"` Masters []SaltMaster `json:"masters,omitempty"` Minions []SaltMinion `json:"minions,omitempty"` Action string `json:"action"` }
func (SaltActionRequest) String ¶
func (r SaltActionRequest) String() string
type SaltMaster ¶
type SaltMaster struct { Address string `json:"address"` Auth SaltAuth `json:"auth,omitempty"` Domain string `json:"domain,omitempty"` }
func (SaltMaster) AsByteArray ¶
func (saltMaster SaltMaster) AsByteArray() []byte
type SaltMinion ¶
type SaltMinion struct { Address string `json:"address"` Roles []string `json:"roles,omitempty"` Server string `json:"server,omitempty"` Servers []string `json:"servers,omitempty"` HostGroup string `json:"hostGroup,omitempty"` Domain string `json:"domain,omitempty"` }
func (SaltMinion) AsByteArray ¶
func (saltMinion SaltMinion) AsByteArray() []byte
type SaltPillar ¶
type SaltPillar struct { Path string `json:"path"` Json map[string]interface{} `json:"json"` Targets []string `json:"targets"` }
func (SaltPillar) WritePillar ¶
func (pillar SaltPillar) WritePillar() (outStr string, err error)
type SecurityConfig ¶
type SecurityConfig struct { Username string `json:"username" yaml:"username"` Password string `json:"password" yaml:"password"` SignVerifyKey string `json:"signKey" yaml:"signKey"` }
func DetermineSecurityDetails ¶
func DetermineSecurityDetails(getEnv func(key string) string, securityConfig func() string) (*SecurityConfig, error)
type Servers ¶
func (*Servers) WriteToFile ¶
type SignatureMethod ¶
type SignatureMethod int
Source Files ¶
Click to show internal directories.
Click to hide internal directories.