config

package
v0.0.0-...-6f48322 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2015 License: LGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

The config package defines an interface which returns packaging-related configuration options and operations depending on the desired package-management system.

Index

Constants

View Source
const (
	// AptSourcesFile is the default file which list all core
	// sources for apt packages on an apt-based system.
	AptSourcesFile = "/etc/apt/sources.list"

	// AptListsDirectory is the location of the APT sources list.
	AptListsDirectory = "/var/lib/apt/lists"

	// AptConfigDirectory is the default directory in which
	// apt configuration files are stored.
	AptConfigDirectory = "/etc/apt/apt.conf.d"

	// ExtractAptSource is a shell command that will extract the
	// currently configured APT source location. We assume that
	// the first source for "main" in the file is the one that
	// should be replaced throughout the file.
	ExtractAptSource = `awk "/^deb .* $(lsb_release -sc) .*main.*\$/{print \$2;exit}" ` + AptSourcesFile

	// AptSourceListPrefix is a shell program that translates an
	// APT source (piped from stdin) to a file prefix. The algorithm
	// involves stripping up to one trailing slash, stripping the
	// URL scheme prefix, and finally translating slashes to
	// underscores.
	AptSourceListPrefix = `sed 's,.*://,,' | sed 's,/$,,' | tr / _`
)
View Source
const (

	// CentOSSourcesFile is the default file which lists all core sources
	// for yum packages on CentOS.
	CentOSSourcesFile = "/etc/yum/repos.d/CentOS-Base.repo"

	// ReplaceCentOSMirror is a mini-script which replaces the default CentOS
	// mirros with the one formatted in.
	ReplaceCentOSMirror = "sed -r -i -e 's|^mirrorlist|#mirrorlist|g' -e 's|#baseurl=.*|baseurl=%s|g' " +
		CentOSSourcesFile
)
View Source
const (
	// UbuntuCloudArchiveUrl is the url of the cloud archive on Ubuntu.
	UbuntuCloudArchiveUrl = "http://ubuntu-cloud.archive.canonical.com/ubuntu"

	// CloudToolsPrefsPath defines the default location of
	// apt_preferences(5) file for the cloud-tools pocket.
	UbuntuCloudToolsPrefsPath = "/etc/apt/preferences.d/50-cloud-tools"

	// UbuntuCloudArchiveSigningKey is the PGP publivc key for the canonical
	// cloud archive on Ubuntu.
	UbuntuCloudArchiveSigningKey = `` /* 3159-byte string literal not displayed */

)
View Source
const (
	// YumSourcesDir is the default directory in which yum sourcefiles are located.
	YumSourcesDir = "/etc/yum/repos.d"

	// YumKeyfileDir is the default directory for yum repository keys.
	YumKeyfileDir = "/etc/pki/rpm-gpg/"
)
View Source
const (
	// PackageManagerLoopFunction is a bash function that executes its arguments
	// in a loop with a delay until either the command either returns
	// with an exit code other than 100.
	PackageManagerLoopFunction = `` /* 284-byte string literal not displayed */

)

Variables

View Source
var (
	// AptProxyConfigFile is the full file path for the proxy settings that are
	// written by cloudinit and the machine environ worker.
	AptProxyConfigFile = AptConfigDirectory + "/42-juju-proxy-settings"

	// AptPreferenceTemplate is the template specific to an apt preference file.
	AptPreferenceTemplate = template.Must(template.New("").Parse(`
Explanation: {{.Explanation}}
Package: {{.Package}}
Pin: {{.Pin}}
Pin-Priority: {{.Priority}}
`[1:]))

	// AptSourceTemplate is the template specific to an apt source file.
	AptSourceTemplate = template.Must(template.New("").Parse(`
# {{.Name}} (added by Juju)
deb {{.URL}} %s main
# deb-src {{.URL}} %s main
`[1:]))
)
View Source
var CentOSDefaultPackages = append(DefaultPackages, []string{

	"epel-release",
	"yum-utils",
}...)

CentOSDefaultPackages is the default package set we'd like installed on all CentOS machines.

View Source
var (

	// DefaultPackages is a list of the default packages Juju'd like to see
	// installed on all it's machines.
	DefaultPackages = []string{

		"curl",
	}
)
View Source
var UbuntuDefaultPackages = append(DefaultPackages, []string{

	"python-software-properties",
}...)

UbuntuDefaultPackages is the default package set we'd like to installed on all Ubuntu machines.

View Source
var UbuntuDefaultRepositories = []string{}

UbuntuDefaultRepositories is the default repository set we'd like to enable on all Ubuntu machines.

View Source
var YumSourceTemplate = template.Must(template.New("").Parse(`
[{{.Name}}]
name={{.Name}} (added by Juju)
baseurl={{.URL}}
{{if .Key}}gpgcheck=1
gpgkey=%s{{end}}
enabled=1
`[1:]))

YumSourceTemplate is the template specific to a yum source file.

Functions

func GetCloudArchiveSource

func GetCloudArchiveSource(series string) (packaging.PackageSource, packaging.PackagePreferences)

GetCloudArchiveSource returns the PackageSource and associated PackagePreferences for the cloud archive for the given series.

func SeriesRequiresCloudArchiveTools

func SeriesRequiresCloudArchiveTools(series string) bool

SeriesRequiresCloudArchiveTools signals whether the given series requires the configuration of cloud archive cloud tools.

Types

type PackagingConfigurer

type PackagingConfigurer interface {
	// DefaultPackages returns a list of default packages whcih should be
	// installed the vast majority of cases on any specific machine
	DefaultPackages() []string

	// GetPackageNameForSeries returns the equivalent package name of the
	// specified package for the given series or an error if no mapping
	// for it exists.
	GetPackageNameForSeries(pack string, series string) (string, error)

	// IsCloudArchivePackage signals whether the given package is a
	// cloud archive package and thus should be set as such.
	IsCloudArchivePackage(pack string) bool

	// ApplyCloudArchiveTarget returns the package with the required target
	// release bits preceding it.
	ApplyCloudArchiveTarget(pack string) []string

	// RenderSource returns the os-specific full file contents
	// of a given PackageSource.
	RenderSource(src packaging.PackageSource) (string, error)

	// RenderPreferences returns the os-specific full file contents of a given
	// set of PackagePreferences.
	RenderPreferences(prefs packaging.PackagePreferences) (string, error)
}

PackagingConfigurer is an interface which handles various packaging-related configuration functions for the specific distribution it represents.

func NewAptPackagingConfigurer

func NewAptPackagingConfigurer(series string) PackagingConfigurer

NewAptPackagingConfigurer returns a PackagingConfigurer for apt-based systems.

func NewPackagingConfigurer

func NewPackagingConfigurer(series string) (PackagingConfigurer, error)

func NewYumPackagingConfigurer

func NewYumPackagingConfigurer(series string) PackagingConfigurer

NewYumPackagingConfigurer returns a PackagingConfigurer for yum-based systems.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL