Пример #1
0
func (s *varsSuite) TestMergeEnvironment(c *gc.C) {
	c.Check(osenv.MergeEnvironment(nil, nil), gc.HasLen, 0)
	newValues := map[string]string{"a": "baz", "c": "omg"}
	created := osenv.MergeEnvironment(nil, newValues)
	expected := map[string]string{"a": "baz", "c": "omg"}
	c.Check(created, jc.DeepEquals, expected)
	// Show that the map returned isn't the one passed in.
	newValues["d"] = "another"
	c.Check(created, jc.DeepEquals, expected)
}
Пример #2
0
// ContainerAgentConf returns the data that defines an init service config
// for the identified agent running in a container.
func ContainerAgentConf(info AgentInfo, renderer shell.Renderer, containerType string) common.Conf {
	conf := AgentConf(info, renderer)

	// TODO(thumper): 2013-09-02 bug 1219630
	// As much as I'd like to remove JujuContainerType now, it is still
	// needed as MAAS still needs it at this stage, and we can't fix
	// everything at once.
	envVars := map[string]string{
		osenv.JujuContainerTypeEnvKey: containerType,
	}
	osenv.MergeEnvironment(envVars, conf.Env)
	conf.Env = envVars

	return conf
}