• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang maas.NewCloudinitConfig函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/juju/juju/provider/maas.NewCloudinitConfig函数的典型用法代码示例。如果您正苦于以下问题:Golang NewCloudinitConfig函数的具体用法?Golang NewCloudinitConfig怎么用?Golang NewCloudinitConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: TestNewCloudinitConfigWithFeatureFlag

func (*environSuite) TestNewCloudinitConfigWithFeatureFlag(c *gc.C) {
	cfg := getSimpleTestConfig(c, nil)
	env, err := maas.NewEnviron(cfg)
	c.Assert(err, jc.ErrorIsNil)
	cloudcfg, err := maas.NewCloudinitConfig(env, "testing.invalid", "eth0", "quantal")
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(cloudcfg.SystemUpdate(), jc.IsTrue)
	c.Assert(cloudcfg.RunCmds(), jc.DeepEquals, expectedCloudinitConfig)
}
开发者ID:exekias,项目名称:juju,代码行数:9,代码来源:environ_test.go


示例2: TestNewCloudinitConfigWithDisabledNetworkManagement

func (*environSuite) TestNewCloudinitConfigWithDisabledNetworkManagement(c *gc.C) {
	attrs := coretesting.Attrs{
		"disable-network-management": true,
	}
	cfg := getSimpleTestConfig(c, attrs)
	env, err := maas.NewEnviron(cfg)
	c.Assert(err, jc.ErrorIsNil)
	cloudcfg, err := maas.NewCloudinitConfig(env, "testing.invalid", "eth0", "quantal")
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(cloudcfg.SystemUpdate(), jc.IsTrue)
	c.Assert(cloudcfg.RunCmds(), jc.DeepEquals, expectedCloudinitConfig)
}
开发者ID:exekias,项目名称:juju,代码行数:12,代码来源:environ_test.go


示例3: TestNewCloudinitConfig

func (*environSuite) TestNewCloudinitConfig(c *gc.C) {
	cfg := getSimpleTestConfig(c, nil)
	env, err := maas.NewEnviron(cfg)
	c.Assert(err, jc.ErrorIsNil)
	modifyNetworkScript := maas.RenderEtcNetworkInterfacesScript()
	script := expectedCloudinitConfig
	script = append(script, modifyNetworkScript)
	cloudcfg, err := maas.NewCloudinitConfig(env, "testing.invalid", "quantal")
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(cloudcfg.SystemUpdate(), jc.IsTrue)
	c.Assert(cloudcfg.RunCmds(), jc.DeepEquals, script)
}
开发者ID:makyo,项目名称:juju,代码行数:12,代码来源:environ_test.go


示例4: TestNewCloudinitConfig

func (*environSuite) TestNewCloudinitConfig(c *gc.C) {
	cloudcfg, err := maas.NewCloudinitConfig("testing.invalid", "eth0")
	c.Assert(err, gc.IsNil)
	c.Assert(cloudcfg.AptUpdate(), jc.IsTrue)
	c.Assert(cloudcfg.RunCmds(), jc.DeepEquals, []interface{}{
		"set -xe",
		"mkdir -p '/var/lib/juju'; echo -n 'hostname: testing.invalid\n' > '/var/lib/juju/MAASmachine.txt'",
		"ifdown eth0",
		"cat > /etc/network/eth0.config << EOF\niface eth0 inet manual\n\nauto br0\niface br0 inet dhcp\n  bridge_ports eth0\nEOF\n",
		`sed -i "s/iface eth0 inet dhcp/source \/etc\/network\/eth0.config/" /etc/network/interfaces`,
		"ifup br0",
	})
}
开发者ID:klyachin,项目名称:juju,代码行数:13,代码来源:environ_test.go


示例5: TestNewCloudinitConfigNoFeatureFlag

func (s *environSuite) TestNewCloudinitConfigNoFeatureFlag(c *gc.C) {
	cfg := getSimpleTestConfig(c, nil)
	env, err := maas.NewEnviron(cfg)
	c.Assert(err, jc.ErrorIsNil)
	testCase := func(expectedConfig []string) {
		cloudcfg, err := maas.NewCloudinitConfig(env, "testing.invalid", "eth0", "quantal")
		c.Assert(err, jc.ErrorIsNil)
		c.Assert(cloudcfg.SystemUpdate(), jc.IsTrue)
		c.Assert(cloudcfg.RunCmds(), jc.DeepEquals, expectedConfig)
	}
	// First test the default case (address allocation feature flag on).
	testCase(expectedCloudinitConfig)

	// Now test with the flag off.
	s.SetFeatureFlags() // clear the flags.
	testCase(expectedCloudinitConfigWithBridge)
}
开发者ID:Pankov404,项目名称:juju,代码行数:17,代码来源:environ_test.go


示例6: TestNewCloudinitConfigNoFeatureFlag

func (s *environSuite) TestNewCloudinitConfigNoFeatureFlag(c *gc.C) {
	cfg := getSimpleTestConfig(c, nil)
	env, err := maas.NewEnviron(cfg)
	c.Assert(err, jc.ErrorIsNil)
	testCase := func(expectedConfig []string) {
		cloudcfg, err := maas.NewCloudinitConfig(env, "testing.invalid", "quantal")
		c.Assert(err, jc.ErrorIsNil)
		c.Assert(cloudcfg.SystemUpdate(), jc.IsTrue)
		c.Assert(cloudcfg.RunCmds(), jc.DeepEquals, expectedConfig)
	}
	// First test the default case (address allocation feature flag on).
	testCase(expectedCloudinitConfig)

	// Now test with the flag off.
	s.SetFeatureFlags() // clear the flags.
	modifyNetworkScript := maas.RenderEtcNetworkInterfacesScript()
	script := expectedCloudinitConfig
	script = append(script, modifyNetworkScript)
	testCase(script)
}
开发者ID:OSBI,项目名称:juju,代码行数:20,代码来源:environ_test.go


示例7: TestNewCloudinitConfig

func (*environSuite) TestNewCloudinitConfig(c *gc.C) {
	cloudcfg, err := maas.NewCloudinitConfig("testing.invalid", "eth0")
	c.Assert(err, gc.IsNil)
	c.Assert(cloudcfg.AptUpdate(), jc.IsTrue)
	c.Assert(cloudcfg.RunCmds(), jc.DeepEquals, expectedCloudinitConfig)
}
开发者ID:jiasir,项目名称:juju,代码行数:6,代码来源:environ_test.go


示例8: TestNewCloudinitConfig

func (*environSuite) TestNewCloudinitConfig(c *gc.C) {
	nwInfo := []network.Info{
		// physical eth0 won't be touched, but it can have VLANs on it.
		{InterfaceName: "eth0", VLANTag: 0, Disabled: false},
		{InterfaceName: "eth0", VLANTag: 99, Disabled: false},
		// physical NIC given explicitly, then a couple of virtual ones using it.
		{InterfaceName: "eth1", VLANTag: 0, Disabled: false},
		{InterfaceName: "eth1", VLANTag: 42, Disabled: false},
		{InterfaceName: "eth1", VLANTag: 69, Disabled: false},
		{InterfaceName: "eth2", VLANTag: 0, Disabled: false},
		// physical NIC not given, ensure it gets brought up first, before the virtual one.
		{InterfaceName: "eth3", VLANTag: 123, Disabled: false},
		// disabled NICs should still be configured (for now)
		{InterfaceName: "eth4", VLANTag: 0, Disabled: true},
		{InterfaceName: "eth4", VLANTag: 12, Disabled: true},
		{InterfaceName: "eth5", VLANTag: 66, Disabled: true},
	}
	cloudcfg, err := maas.NewCloudinitConfig("testing.invalid", nwInfo)
	c.Assert(err, gc.IsNil)
	c.Assert(cloudcfg.AptUpdate(), jc.IsTrue)
	c.Assert(cloudcfg.RunCmds(), jc.DeepEquals, []interface{}{
		"set -xe",
		"mkdir -p '/var/lib/juju'; echo -n 'hostname: testing.invalid\n' > '/var/lib/juju/MAASmachine.txt'",
		"ifdown eth0",
		"cat > /etc/network/eth0.config << EOF\niface eth0 inet manual\n\nauto br0\niface br0 inet dhcp\n  bridge_ports eth0\nEOF\n",
		`sed -i "s/iface eth0 inet dhcp/source \/etc\/network\/eth0.config/" /etc/network/interfaces`,
		"ifup br0",
		// Networking/VLAN stuff.
		"sh -c 'lsmod | grep -q 8021q || modprobe 8021q'",
		"sh -c 'grep -q 8021q /etc/modules || echo 8021q >> /etc/modules'",
		"vconfig set_name_type DEV_PLUS_VID_NO_PAD",
		"vconfig add eth0 99",
		"cat >> /etc/network/interfaces << EOF\n\nauto eth0.99\niface eth0.99 inet dhcp\nEOF\n",
		"ifup eth0.99",
		"cat >> /etc/network/interfaces << EOF\n\nauto eth1\niface eth1 inet dhcp\nEOF\n",
		"ifup eth1",
		"vconfig add eth1 42",
		"cat >> /etc/network/interfaces << EOF\n\nauto eth1.42\niface eth1.42 inet dhcp\nEOF\n",
		"ifup eth1.42",
		"vconfig add eth1 69",
		"cat >> /etc/network/interfaces << EOF\n\nauto eth1.69\niface eth1.69 inet dhcp\nEOF\n",
		"ifup eth1.69",
		"cat >> /etc/network/interfaces << EOF\n\nauto eth2\niface eth2 inet dhcp\nEOF\n",
		"ifup eth2",
		"cat >> /etc/network/interfaces << EOF\n\nauto eth3\niface eth3 inet dhcp\nEOF\n",
		"ifup eth3",
		"vconfig add eth3 123",
		"cat >> /etc/network/interfaces << EOF\n\nauto eth3.123\niface eth3.123 inet dhcp\nEOF\n",
		"ifup eth3.123",
		"cat >> /etc/network/interfaces << EOF\n\nauto eth4\niface eth4 inet dhcp\nEOF\n",
		"ifup eth4",
		"vconfig add eth4 12",
		"cat >> /etc/network/interfaces << EOF\n\nauto eth4.12\niface eth4.12 inet dhcp\nEOF\n",
		"ifup eth4.12",
		"cat >> /etc/network/interfaces << EOF\n\nauto eth5\niface eth5 inet dhcp\nEOF\n",
		"ifup eth5",
		"vconfig add eth5 66",
		"cat >> /etc/network/interfaces << EOF\n\nauto eth5.66\niface eth5.66 inet dhcp\nEOF\n",
		"ifup eth5.66",
	})
}
开发者ID:rogpeppe,项目名称:juju,代码行数:61,代码来源:environ_test.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang maas.NewEnviron函数代码示例发布时间:2022-05-23
下一篇:
Golang lxdclient.Remote类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap