Skip to content

Commit

Permalink
Use utils.Errorf
Browse files Browse the repository at this point in the history
  • Loading branch information
nadvornik authored and admd committed May 22, 2024
1 parent 443a742 commit 1f6b9c4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions mgradm/cmd/install/podman/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ func setupHubXmlrpcContainer(flags *podmanInstallFlags) error {
}
hubXmlrpcImage, err := utils.ComputeImage(flags.HubXmlrpc.Image.Name, tag)
if err != nil {
return fmt.Errorf(L("failed to compute image URL, %s"), err)
return utils.Errorf(err, L("failed to compute image URL"))
}

if err := podman.GenerateHubXmlrpcSystemdService(hubXmlrpcImage); err != nil {
return fmt.Errorf(L("cannot generate systemd service: %s"), err)
return utils.Errorf(err, L("cannot generate systemd service"))
}

if err := shared_podman.EnableService(shared_podman.HubXmlrpcService); err != nil {
return fmt.Errorf(L("cannot enable service: %s"), err)
return utils.Errorf(err, L("cannot enable service"))
}
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion mgradm/cmd/status/podman.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func podmanStatus(

if podman.HasService(podman.HubXmlrpcService) {
if err := utils.RunCmdStdMapping(zerolog.DebugLevel, "systemctl", "status", podman.HubXmlrpcService); err != nil {
return fmt.Errorf(L("failed to get status of the server service: %s"), err)
return utils.Errorf(err, L("failed to get status of the server service"))
}
}

Expand Down
4 changes: 2 additions & 2 deletions mgradm/shared/podman/podman.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ func GenerateHubXmlrpcSystemdService(image string) error {
Image: image,
}
if err := utils.WriteTemplateToFile(hubXmlrpcData, podman.GetServicePath(podman.HubXmlrpcService), 0555, false); err != nil {
return fmt.Errorf(L("failed to generate systemd service unit file: %s"), err)
return utils.Errorf(err, L("failed to generate systemd service unit file"))
}

environment := fmt.Sprintf(`Environment=UYUNI_IMAGE=%s
`, image)
if err := podman.GenerateSystemdConfFile(podman.HubXmlrpcService, "Service", environment); err != nil {
return fmt.Errorf(L("cannot generate systemd conf file: %s"), err)
return utils.Errorf(err, L("cannot generate systemd conf file"))
}

return podman.ReloadDaemon(false)
Expand Down

0 comments on commit 1f6b9c4

Please sign in to comment.