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


Golang maas.NewCloudinitConfig函数代码示例

本文整理汇总了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;未经允许,请勿转载。