示例#1
0
// AddAptCommands update the cloudinit.Config instance with the necessary
// packages, the request to do the apt-get update/upgrade on boot, and adds
// the apt proxy settings if there are any.
func AddAptCommands(proxySettings proxy.Settings, c *cloudinit.Config) {
	// Bring packages up-to-date.
	c.SetAptUpdate(true)
	c.SetAptUpgrade(true)

	// juju requires git for managing charm directories.
	c.AddPackage("git")
	c.AddPackage("curl")
	c.AddPackage("cpu-checker")
	c.AddPackage("bridge-utils")
	c.AddPackage("rsyslog-gnutls")

	// Write out the apt proxy settings
	if (proxySettings != proxy.Settings{}) {
		filename := apt.ConfFile
		c.AddBootCmd(fmt.Sprintf(
			`[ -f %s ] || (printf '%%s\n' %s > %s)`,
			filename,
			shquote(apt.ProxyContent(proxySettings)),
			filename))
	}
}
示例#2
0
文件: cloudinit.go 项目: kapilt/juju
// AddAptCommands update the cloudinit.Config instance with the necessary
// packages, the request to do the apt-get update/upgrade on boot, and adds
// the apt proxy settings if there are any.
func AddAptCommands(
	proxySettings proxy.Settings,
	c *cloudinit.Config,
	addUpdateScripts bool,
	addUpgradeScripts bool,
) {
	// Check preconditions
	if c == nil {
		panic("c is nil")
	}

	// Bring packages up-to-date.
	c.SetAptUpdate(addUpdateScripts)
	c.SetAptUpgrade(addUpgradeScripts)
	c.SetAptGetWrapper("eatmydata")

	// If we're not doing an update, adding these packages is
	// meaningless.
	if addUpdateScripts {
		c.AddPackage("curl")
		c.AddPackage("cpu-checker")
		// TODO(axw) 2014-07-02 #1277359
		// Don't install bridge-utils in cloud-init;
		// leave it to the networker worker.
		c.AddPackage("bridge-utils")
		c.AddPackage("rsyslog-gnutls")
	}

	// Write out the apt proxy settings
	if (proxySettings != proxy.Settings{}) {
		filename := apt.ConfFile
		c.AddBootCmd(fmt.Sprintf(
			`[ -f %s ] || (printf '%%s\n' %s > %s)`,
			filename,
			shquote(apt.ProxyContent(proxySettings)),
			filename))
	}
}
示例#3
0
// AddAptCommands update the cloudinit.Config instance with the necessary
// packages, the request to do the apt-get update/upgrade on boot, and adds
// the apt proxy settings if there are any.
func AddAptCommands(proxySettings proxy.Settings, c *cloudinit.Config) {
	// Bring packages up-to-date.
	c.SetAptUpdate(true)
	c.SetAptUpgrade(true)
	c.SetAptGetWrapper("eatmydata")

	c.AddPackage("curl")
	c.AddPackage("cpu-checker")
	// TODO(axw) 2014-07-02 #1277359
	// Don't install bridge-utils in cloud-init;
	// leave it to the networker worker.
	c.AddPackage("bridge-utils")
	c.AddPackage("rsyslog-gnutls")

	// Write out the apt proxy settings
	if (proxySettings != proxy.Settings{}) {
		filename := apt.ConfFile
		c.AddBootCmd(fmt.Sprintf(
			`[ -f %s ] || (printf '%%s\n' %s > %s)`,
			filename,
			shquote(apt.ProxyContent(proxySettings)),
			filename))
	}
}