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 DistributePayload(clients []string, payloads []Payload, endpoint string, user string, ...) <-chan model.Response
- func ExecCmd(executable string, args ...string) (outStr string, err error)
- func FileUploadHandler(w http.ResponseWriter, req *http.Request)
- func GetAuthUserPass(r *http.Request) (string, string)
- func HealthCheckHandler(w http.ResponseWriter, req *http.Request)
- func LaunchService(service string) (resp model.Response, err error)
- func NewCloudbreakBootstrapWeb()
- 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 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, up bool) (resp model.Response, err error)
- func StopService(service string) (resp model.Response, err error)
- func Unzip(src, dest string) error
- type Authenticator
- type Clients
- type GrainConfig
- type InitSystem
- type Payload
- type SaltActionRequest
- type SaltAuth
- type SaltMaster
- type SaltMinion
- type SaltPillar
- type SecurityConfig
- type Server
- type Servers
- type SignatureMethod
Constants ¶
View Source
const ( ENV_TYPE = "SALT_BOOTSTRAP_ENV_TYPE" EXECUTED_COMMANDS = "EXECUTED_COMMANDS" )
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" HostnameDistributeEP = RootPath + "/hostname/distribute" HostnameEP = RootPath + "/hostname" UploadEP = RootPath + "/file" )
View Source
const SALT_USER = "saltuser"
Variables ¶
View Source
var ( SYSYEM_D = InitSystem{ActionBin: "/bin/systemctl", StateBin: "/bin/systemctl", Start: "start", Stop: "stop", Enable: "enable", Disable: "disable", CommandOrderASC: true} SYS_V_INIT = InitSystem{ActionBin: "/sbin/service", StateBin: "/sbin/chkconfig", Start: "start", Stop: "stop", 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 DistributePayload ¶
func FileUploadHandler ¶
func FileUploadHandler(w http.ResponseWriter, req *http.Request)
func HealthCheckHandler ¶
func HealthCheckHandler(w http.ResponseWriter, req *http.Request)
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 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 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, run bool) []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"` Minions []SaltMinion `json:"minions,omitempty"` Action string `json:"action"` }
func (SaltActionRequest) String ¶
func (r SaltActionRequest) String() string
type SaltMaster ¶
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"` HostGroup string `json:"hostGroup,omitempty"` }
func (SaltMinion) AsByteArray ¶
func (saltMinion SaltMinion) AsByteArray() []byte
type SaltPillar ¶
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 ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.