Documentation ¶
Overview ¶
Package cloudinit implements write_files and runcmd directives of cloudinit.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CmdRunner ¶
type CmdRunner struct { }
CmdRunner default implementer of ICmdRunner TODO reevaluate empty interface/struct
type FileWriter ¶
type FileWriter struct { }
FileWriter default implementation of IFileWriter
func (FileWriter) MkdirIfNotExists ¶
func (w FileWriter) MkdirIfNotExists(dirName string) error
MkdirIfNotExists creates the directory if it does not exist already
func (FileWriter) WriteToFile ¶
func (w FileWriter) WriteToFile(file *Files) error
WriteToFile writes contents to file with appropriate permissions as provided in the write_files directive of cloud-config file
type Files ¶
type Files struct { Path string `json:"path,"` Encoding string `json:"encoding,omitempty"` Owner string `json:"owner,omitempty"` Permissions string `json:"permissions,omitempty"` Content string `json:"content"` Append bool `json:"append,omitempty"` }
Files details required for files written by bootstrap script
type IFileWriter ¶
type ITemplateParser ¶
type ScriptExecutor ¶
type ScriptExecutor struct { WriteFilesExecutor IFileWriter RunCmdExecutor ICmdRunner ParseTemplateExecutor ITemplateParser }
ScriptExecutor bootstrap script executor
func (ScriptExecutor) Execute ¶
func (se ScriptExecutor) Execute(bootstrapScript string) error
Execute performs the following operations on the bootstrap script
- parse the script to get the cloudinit data
- execute the write_files directive
- execute the run_cmd directive
type TemplateParser ¶
type TemplateParser struct {
Template interface{}
}
TemplateParser cloudinit templates parsing using ITemplateParser
func (TemplateParser) ParseTemplate ¶
func (tp TemplateParser) ParseTemplate(templateContent string) (string, error)
ParseTemplate parses and returns the parsed template content