Documentation ¶
Overview ¶
Package pct implements the Puppet Content template specification
Puppet Content Templates (PCT) codify a structure to produce content for any Puppet Product. PCT can create any type of a Puppet Product project: Puppet control repo, Puppet Module, Bolt project, etc. PCT can also create one or more independent files, such as CI files or gitignores. This can be as simple as a name for a Puppet Class or a set of CI files to add to a Puppet Module.
Index ¶
- Constants
- type DeployInfo
- type PDKInfo
- type Pct
- func (p *Pct) Deploy(info DeployInfo) []string
- func (*Pct) DisplayDefaults(defaults map[string]interface{}, format string) string
- func (p *Pct) FilterFiles(ss []PuppetContentTemplate, test func(PuppetContentTemplate) bool) (ret []PuppetContentTemplate)
- func (*Pct) FormatDeployment(deployed []string, jsonOutput string) error
- func (*Pct) FormatTemplates(tmpls []PuppetContentTemplate, jsonOutput string) (string, error)
- func (p *Pct) Get(templateDirPath string) (PuppetContentTemplate, error)
- func (p *Pct) GetInfo(templateDirPath string) (PuppetContentTemplateInfo, error)
- func (p *Pct) List(templatePath string, templateName string) []PuppetContentTemplate
- type PctI
- type PuppetContentTemplate
- type PuppetContentTemplateFileInfo
- type PuppetContentTemplateInfo
Constants ¶
const ( TemplateConfigName = "pct-config" TemplateConfigFileName = "pct-config.yml" UserTemplateConfigName = "pct" UserTemplateConfigFileName = "pct.yml" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeployInfo ¶
type DeployInfo struct { SelectedTemplate string TemplateDirPath string TargetOutputDir string TargetName string PdkInfo PDKInfo }
DeployInfo represents the final set of information needed to deploy a template
type PDKInfo ¶
PDKInfo contains the current version information of the compiled binary for use in template data
type Pct ¶
type Pct struct { OsUtils utils.OsUtilI Utils utils.UtilsHelperI AFS *afero.Afero IOFS *afero.IOFS }
func (*Pct) Deploy ¶
func (p *Pct) Deploy(info DeployInfo) []string
Deploy deploys a selected template to a target path with a target name using data from both the configuration inside the template and provided by the User in their user config file
func (*Pct) DisplayDefaults ¶
DisplayDefaults returns the Default values from a Templates configuration file
func (*Pct) FilterFiles ¶
func (p *Pct) FilterFiles(ss []PuppetContentTemplate, test func(PuppetContentTemplate) bool) (ret []PuppetContentTemplate)
func (*Pct) FormatDeployment ¶
FormatDeployment formats the files returned by the Deploy method to display on the console in table format or json format.
func (*Pct) FormatTemplates ¶
func (*Pct) FormatTemplates(tmpls []PuppetContentTemplate, jsonOutput string) (string, error)
FormatTemplates formats one or more templates to display on the console in table format or json format.
type PctI ¶
type PctI interface { GetInfo(templateCache string, selectedTemplate string) (PuppetContentTemplateInfo, error) List(templatePath string, templateName string) ([]PuppetContentTemplate, error) FormatTemplates(tmpls []PuppetContentTemplate, jsonOutput string) error DisplayDefaults(defaults map[string]interface{}, format string) string FormatDeployment(deployed []string, jsonOutput string) error Deploy(info DeployInfo) []string }
type PuppetContentTemplate ¶
type PuppetContentTemplate struct { install.ConfigParams `mapstructure:",squash"` Type string `mapstructure:"type"` Display string `mapstructure:"display"` URL string `mapstructure:"url"` }
PuppetContentTemplate houses the actual information about each template
type PuppetContentTemplateFileInfo ¶
type PuppetContentTemplateFileInfo struct { TemplatePath string TargetFilePath string TargetDir string TargetFile string IsDirectory bool }
PuppetContentTemplateFileInfo represents the resolved target path information for a given template
type PuppetContentTemplateInfo ¶
type PuppetContentTemplateInfo struct { Template PuppetContentTemplate `mapstructure:"template"` Defaults map[string]interface{} }
PuppetContentTemplateInfo is the housing struct for marshaling YAML data