// addPackageSourceCmds is a helper function that returns the corresponding // runcmds to apply the package source settings on a CentOS machine. func addPackageSourceCmds(cfg CloudConfig, src packaging.PackageSource) []string { cmds := []string{} // if keyfile is required, add it first if src.Key != "" { keyFilePath := config.YumKeyfileDir + src.KeyFileName() cmds = append(cmds, addFileCmds(keyFilePath, []byte(src.Key), 0644, false)...) } repoPath := filepath.Join(config.YumSourcesDir, src.Name+".repo") sourceFile, _ := cfg.getPackagingConfigurer().RenderSource(src) data := []byte(sourceFile) cmds = append(cmds, addFileCmds(repoPath, data, 0644, false)...) return cmds }
// RenderSource is defined on the PackagingConfigurer interface. func (c *aptConfigurer) RenderSource(src packaging.PackageSource) (string, error) { return src.RenderSourceFile(AptSourceTemplate) }