chore(package_lxd_test): create valid config, additional debug output (#12225)

This commit is contained in:
Joshua Powers 2022-11-14 13:41:22 -07:00 committed by GitHub
parent 2ade360728
commit 4c67b956bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -96,15 +96,31 @@ func (c *Container) Install(packageName ...string) error {
func (c *Container) CheckStatus(serviceName string) error {
// the RPM does not start automatically service on install
// write valid, but simple config file and start
if c.packageManager != "apt" {
err := c.client.Exec(c.Name, "systemctl", "start", serviceName)
err := c.client.Exec(
c.Name,
"bash",
"-c",
"--",
"echo '[[inputs.cpu]]\n[[outputs.file]]' | "+
"tee /etc/telegraf/telegraf.conf",
)
if err != nil {
return err
}
err = c.client.Exec(c.Name, "systemctl", "start", serviceName)
if err != nil {
_ = c.client.Exec(c.Name, "systemctl", "status", serviceName)
_ = c.client.Exec(c.Name, "journalctl", "--no-pager", "--unit", serviceName)
return err
}
}
err := c.client.Exec(c.Name, "systemctl", "status", serviceName)
if err != nil {
_ = c.client.Exec(c.Name, "journalctl", "--no-pager", "--unit", serviceName)
return err
}

View File

@ -143,6 +143,8 @@ func (c *LXDClient) Exec(name string, command ...string) error {
return fmt.Errorf(output.String())
}
fmt.Println(output.String())
return nil
}