当前位置: 首页>>代码示例>>Golang>>正文


Golang Config.AddPackage方法代码示例

本文整理汇总了Golang中github.com/juju/juju/cloudinit.Config.AddPackage方法的典型用法代码示例。如果您正苦于以下问题:Golang Config.AddPackage方法的具体用法?Golang Config.AddPackage怎么用?Golang Config.AddPackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/juju/juju/cloudinit.Config的用法示例。


在下文中一共展示了Config.AddPackage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: AddAptCommands

// 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))
	}
}
开发者ID:rogpeppe,项目名称:juju,代码行数:25,代码来源:cloudinit.go

示例2: AddAptCommands

// 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))
	}
}
开发者ID:kapilt,项目名称:juju,代码行数:41,代码来源:cloudinit.go

示例3: AddAptCommands

// 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))
	}
}
开发者ID:,项目名称:,代码行数:27,代码来源:


注:本文中的github.com/juju/juju/cloudinit.Config.AddPackage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。