Пример #1
0
func (c Conf) checkExec(name, cmd string, renderer shell.Renderer) error {
	path := executable(cmd)
	if !renderer.IsAbs(path) {
		return errors.NotValidf("relative path in %s (%s)", name, path)
	}
	return nil
}
Пример #2
0
// execArgs returns an unquoted array of service arguments in case we need
// them later. One notable place where this is needed, is the windows service
// package, where CreateService correctly does quoting of executable path and
// individual arguments
func (ai AgentInfo) execArgs(renderer shell.Renderer) []string {
	return []string{
		string(ai.Kind),
		"--data-dir", renderer.FromSlash(ai.DataDir),
		idOptions[ai.Kind], ai.ID,
		"--debug",
	}
}
Пример #3
0
// WriteCommands is defined on Config interface.
func (c *configInternal) WriteCommands(renderer shell.Renderer) ([]string, error) {
	data, err := c.fileContents()
	if err != nil {
		return nil, errors.Trace(err)
	}
	commands := renderer.MkdirAll(c.Dir())
	filename := c.File(agentConfigFilename)
	commands = append(commands, renderer.WriteFile(filename, data)...)
	commands = append(commands, renderer.Chmod(filename, 0600)...)
	return commands, nil
}
Пример #4
0
func (ai AgentInfo) cmd(renderer shell.Renderer) string {
	// The agent always starts with debug turned on. The logger worker
	// will update this to the system logging environment as soon as
	// it starts.
	return strings.Join([]string{
		renderer.Quote(ai.jujud(renderer)),
		string(ai.Kind),
		"--data-dir", renderer.Quote(renderer.FromSlash(ai.DataDir)),
		idOptions[ai.Kind], ai.ID,
		"--debug",
	}, " ")
}
Пример #5
0
func (ai AgentInfo) jujud(renderer shell.Renderer) string {
	exeName := "jujud" + renderer.ExeSuffix()
	return renderer.Join(ai.ToolsDir(renderer), exeName)
}
Пример #6
0
// ToolsDir returns the path to the agent's tools dir.
func (ai AgentInfo) ToolsDir(renderer shell.Renderer) string {
	return renderer.FromSlash(tools.ToolsDir(ai.DataDir, ai.name))
}
Пример #7
0
func (ai AgentInfo) logFile(renderer shell.Renderer) string {
	return renderer.Join(renderer.FromSlash(ai.LogDir), ai.name+".log")
}