Documentation ¶
Index ¶
- Constants
- func DelTemplFile(name string) error
- func GenerateRSAKey() (string, string, error)
- func InitConfig(svr *Server, args ...string) *util.ExecResult
- func SetServer(svr *Server) error
- func SetTemplate(templ *Template) error
- func SyncConfig(svr *Server, args ...string) *util.ExecResult
- func SyncSaltConfig(svr *Server) error
- func SyncServerConfig() error
- func SyncTemplFile(templ *Template) error
- type Cache
- type CacheHandler
- type Config
- type ConfigHandler
- type DefaultHandler
- type Server
- type ServerHandler
- type Template
- type TemplateHandler
Constants ¶
View Source
const ( EXPIRE_INTERVAL = 5 * time.Minute CLEANUP_INTERVAL = 1 * time.Minute )
View Source
const (
CONFIG_TEMPLATE = `
{{ range $k, $v := .Config }}
{{printf "%s = salt['pillar.get']('%s', '%s')" $k $k $v }}
{{ end }}
`
)
View Source
const (
MINION_TEMPLATE = `` /* 195-byte string literal not displayed */
)
Variables ¶
This section is empty.
Functions ¶
func GenerateRSAKey ¶
func InitConfig ¶
func InitConfig(svr *Server, args ...string) *util.ExecResult
InitConfig is used to init the server's salt minion config
func SetServer ¶
SetServer generate saltstack config for minion server and restart saltstack minion.
func SyncConfig ¶
func SyncConfig(svr *Server, args ...string) *util.ExecResult
SyncConfig is used to sync config info into minion
func SyncServerConfig ¶
func SyncServerConfig() error
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
var (
ConfigsCache *Cache
)
var (
ServerCache *Cache
)
var (
TemplateCache *Cache
)
func NewConfigCache ¶
func NewServerCache ¶
func NewTemplateCache ¶
type CacheHandler ¶
type CacheHandler interface { Key(v interface{}) (string, bool) // parse key from obj SetKey(v interface{}, key string) error // set key for obj Get(key string) (interface{}, error) // Get data Set(key string, value interface{}) error // set data All() ([]interface{}, error) // load all data Delete(key string) error // delete data }
type ConfigHandler ¶
type ConfigHandler struct {
*DefaultHandler
}
func (*ConfigHandler) Key ¶
func (h *ConfigHandler) Key(v interface{}) (string, bool)
func (*ConfigHandler) SetKey ¶
func (h *ConfigHandler) SetKey(v interface{}, key string) error
type DefaultHandler ¶
type DefaultHandler struct {
// contains filtered or unexported fields
}
func (*DefaultHandler) All ¶
func (h *DefaultHandler) All() ([]interface{}, error)
func (*DefaultHandler) Delete ¶
func (h *DefaultHandler) Delete(key string) error
func (*DefaultHandler) Get ¶
func (h *DefaultHandler) Get(key string) (interface{}, error)
func (*DefaultHandler) Set ¶
func (h *DefaultHandler) Set(key string, value interface{}) error
type Server ¶
type Server struct { Name string `json:"name" bson:"_id"` IPAddr string `json:"ipaddr" bson:"ipaddr"` SshPort int `json:"sshport" bson:"sshport"` UserName string `json:"username" bson:"username"` Passwd string `json:"passwd" bson:"passwd"` Env string `json:"env" bson:"env"` Version string `json:"version" bson:"version"` }
type ServerHandler ¶
type ServerHandler struct {
*DefaultHandler
}
func (*ServerHandler) Key ¶
func (h *ServerHandler) Key(value interface{}) (string, bool)
func (*ServerHandler) SetKey ¶
func (h *ServerHandler) SetKey(v interface{}, key string) error
type TemplateHandler ¶
type TemplateHandler struct {
*DefaultHandler
}
func (*TemplateHandler) Key ¶
func (h *TemplateHandler) Key(v interface{}) (string, bool)
func (*TemplateHandler) SetKey ¶
func (h *TemplateHandler) SetKey(v interface{}, key string) error
Click to show internal directories.
Click to hide internal directories.