chore(package_lxd_test): create valid config, additional debug output (#12225)
This commit is contained in:
parent
2ade360728
commit
4c67b956bf
|
|
@ -96,15 +96,31 @@ func (c *Container) Install(packageName ...string) error {
|
||||||
|
|
||||||
func (c *Container) CheckStatus(serviceName string) error {
|
func (c *Container) CheckStatus(serviceName string) error {
|
||||||
// the RPM does not start automatically service on install
|
// the RPM does not start automatically service on install
|
||||||
|
// write valid, but simple config file and start
|
||||||
if c.packageManager != "apt" {
|
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 {
|
if err != nil {
|
||||||
return err
|
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)
|
err := c.client.Exec(c.Name, "systemctl", "status", serviceName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
_ = c.client.Exec(c.Name, "journalctl", "--no-pager", "--unit", serviceName)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,8 @@ func (c *LXDClient) Exec(name string, command ...string) error {
|
||||||
return fmt.Errorf(output.String())
|
return fmt.Errorf(output.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println(output.String())
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue