Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2024 SUSE LLC
# SPDX-FileCopyrightText: 2026 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0

Expand Down Expand Up @@ -27,9 +27,9 @@ RUN set -euo pipefail; \
uyuni-releng-tools \
util-linux

RUN curl -sSfL https://github.com/golangci/golangci-lint/releases/download/v2.7.1/golangci-lint-2.7.1-linux-amd64.tar.gz | tar -xz && \
mv golangci-lint-2.7.1-linux-amd64/golangci-lint /usr/local/bin/ && \
rm -rf golangci-lint-2.7.1-linux-amd64
RUN curl --proto "=https" --tlsv1.2 -sSfL https://github.com/golangci/golangci-lint/releases/download/v2.12.2/golangci-lint-2.7.1-linux-amd64.tar.gz | tar -xz && \
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
mv golangci-lint-2.12.2-linux-amd64/golangci-lint /usr/local/bin/ && \
rm -rf golangci-lint-2.12.2-linux-amd64

RUN set -euo pipefail; zypper -n clean -a; \
rm -rf {/target,}/var/log/{alternatives.log,lastlog,tallylog,zypper.log,zypp/history,YaST2}
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023 SUSE LLC
# SPDX-FileCopyrightText: 2026 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2024 SUSE LLC
# SPDX-FileCopyrightText: 2026 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0

Expand Down Expand Up @@ -30,7 +30,7 @@ jobs:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: v2.7.1
version: v2.12.2

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/mingo_build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2025 SUSE LLC
# SPDX-FileCopyrightText: 2026 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0

Expand Down Expand Up @@ -29,6 +29,11 @@ jobs:
with:
go-version: '1.19'

- name: Hack the go version
run: |
# Hack the go.mod to check that it really builds on 1.19
sed -i 's/go [0-9.]\+/go 1.19/' go.mod

- name: Install dependencies
run: |
go get ./...
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023 SUSE LLC
# SPDX-FileCopyrightText: 2026 SUSE LLC
#
# SPDX-License-Identifier: Apache-2.0

Expand All @@ -8,3 +8,4 @@ vendor.tar.gz
__pycache__
**/tags
*.mo
*-uyuni-tools-uyunitools-main
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/golangci/golangci-lint
rev: v2.7.1
rev: v2.12.2
hooks:
- id: golangci-lint
fail_fast: true
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/uyuni-project/uyuni-tools

go 1.21
go 1.25.0

require (
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2
Expand Down
2 changes: 1 addition & 1 deletion mgradm/cmd/backup/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func doRestore(
var backupError *shared.BackupError
ok := errors.As(err, &backupError)
if ok {
log.Warn().Err(backupError).Msgf(L("Encountered problems:"))
log.Warn().Err(backupError).Msg(L("Encountered problems:"))
if backupError.Abort && backupError.DataRemains {
return errors.New(L("Restore aborted with partially restored files. Resolve the error and try again"))
}
Expand Down
4 changes: 2 additions & 2 deletions mgradm/cmd/backup/restore/podman_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func defaultPodmanNetwork(flags *shared.Flagpole) error {

func restorePodmanNetwork(header *tar.Header, tr *tar.Reader, flags *shared.Flagpole) error {
if flags.DryRun {
log.Info().Msgf(L("Would restore network configuration"))
log.Info().Msg(L("Would restore network configuration"))
return nil
}
data := make([]byte, header.Size)
Expand Down Expand Up @@ -170,7 +170,7 @@ func parseSecretsData(data []byte) ([]shared.BackupSecretMap, error) {

func restorePodmanSecrets(header *tar.Header, tr *tar.Reader, flags *shared.Flagpole) error {
if flags.DryRun {
log.Info().Msgf(L("Would restore podman secrets"))
log.Info().Msg(L("Would restore podman secrets"))
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion mgradm/cmd/backup/restore/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func restorePodmanConfig(inputDirectory string, flags *shared.Flagpole) error {
}

func restoreSystemdConfig(inputDirectory string, flags *shared.Flagpole) error {
log.Info().Msgf(L("Restoring systemd configuration"))
log.Info().Msg(L("Restoring systemd configuration"))
systemdConfigFile := path.Join(inputDirectory, shared.SystemdConfBackupFile)
if !utils.FileExists(systemdConfigFile) {
log.Warn().Msg(L("systemd backup not found in the backup location, generating defaults"))
Expand Down
2 changes: 1 addition & 1 deletion mgradm/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func NewUyuniadmCommand() (*cobra.Command, error) {
utils.LogInit(true)
utils.SetLogLevel(globalFlags.LogLevel)
log.Info().Msgf(L("Starting %s"), strings.Join(os.Args, " "))
log.Info().Msgf(L("Use of this software implies acceptance of the End User License Agreement."))
log.Info().Msg(L("Use of this software implies acceptance of the End User License Agreement."))
}
}

Expand Down
6 changes: 3 additions & 3 deletions mgradm/cmd/distro/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func registerDistro(connection *api.ConnectionDetails, distro *types.Distributio
err = client.Login()
}
if err != nil {
return utils.Errorf(err, L("unable to login and register the distribution. Manual distro registration is required"))
return utils.Error(err, L("unable to login and register the distribution. Manual distro registration is required"))
}

data := map[string]interface{}{
Expand All @@ -63,7 +63,7 @@ func registerDistro(connection *api.ConnectionDetails, distro *types.Distributio

_, err = client.PostChecked("kickstart/tree/create", "api.kickstart.tree.create", data)
if err != nil {
return utils.Errorf(err, L("unable to register the distribution. Manual distro registration is required"))
return utils.Error(err, L("unable to register the distribution. Manual distro registration is required"))
}
log.Info().Msgf(L("Distribution %s successfully registered"), distro.TreeLabel)
return nil
Expand Down Expand Up @@ -195,6 +195,6 @@ func distroCp(
return registerDistro(&flags.ConnectionDetails, &distribution, flags)
}

log.Info().Msgf(L("Continue by registering autoinstallation distribution"))
log.Info().Msg(L("Continue by registering autoinstallation distribution"))
return nil
}
6 changes: 3 additions & 3 deletions mgradm/cmd/gpg/add/gpg.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2025 SUSE LLC
// SPDX-FileCopyrightText: 2026 SUSE LLC
//
// SPDX-License-Identifier: Apache-2.0

Expand Down Expand Up @@ -127,14 +127,14 @@ func gpgAddKeys(_ *types.GlobalFlags, flags *gpgAddFlags, _ *cobra.Command, args

log.Info().Msgf(L("Running %s"), strings.Join(gpgAddCmd, " "))
if err := adm_utils.ExecCommand(zerolog.InfoLevel, cnx, gpgAddCmd...); err != nil {
return utils.Errorf(err, L("failed to run import key"))
return utils.Error(err, L("failed to run import key"))
}

// this is for running import-suma-build-keys, who import customer-build-keys.gpg
uyuniUpdateCmd := []string{"systemctl", "restart", "uyuni-update-config"}
log.Info().Msgf(L("Running %s"), strings.Join(uyuniUpdateCmd, " "))
if err := adm_utils.ExecCommand(zerolog.InfoLevel, cnx, uyuniUpdateCmd...); err != nil {
return utils.Errorf(err, L("failed to restart uyuni-update-config"))
return utils.Error(err, L("failed to restart uyuni-update-config"))
}
return err
}
4 changes: 2 additions & 2 deletions mgradm/cmd/gpg/list/gpg.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2025 SUSE LLC
// SPDX-FileCopyrightText: 2026 SUSE LLC
//
// SPDX-License-Identifier: Apache-2.0

Expand Down Expand Up @@ -63,7 +63,7 @@ func gpgListKeys(_ *types.GlobalFlags, flags *gpgListFlags, _ *cobra.Command, _
if err := adm_utils.ExecCommand(
zerolog.InfoLevel, cnx, gpgListCmd...,
); err != nil {
return utils.Errorf(err, L("failed to list keys in selected keyring"))
return utils.Error(err, L("failed to list keys in selected keyring"))
}

return nil
Expand Down
6 changes: 3 additions & 3 deletions mgradm/cmd/inspect/podman.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ func podmanInspect(
}
inspectResult, err := podman.Inspect(preparedServerImage, preparedDBImage)
if err != nil {
return utils.Errorf(err, L("inspect command failed"))
return utils.Error(err, L("inspect command failed"))
}
prettyInspectOutput, err := json.MarshalIndent(inspectResult, "", " ")
if err != nil {
return utils.Errorf(err, L("cannot print inspect result"))
return utils.Error(err, L("cannot print inspect result"))
}

outputString := "\n" + string(prettyInspectOutput)
log.Info().Msgf(outputString)
log.Info().Msg(outputString)

return nil
}
2 changes: 1 addition & 1 deletion mgradm/cmd/install/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func installForPodman(

preparedImage, preparedPgsqlImage, err := shared_podman.PrepareImages(authFile, flags.Image, flags.Pgsql)
if err != nil {
return utils.Errorf(err, L("cannot prepare images"))
return utils.Error(err, L("cannot prepare images"))
}

if err := shared_podman.SetupNetwork(false); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion mgradm/cmd/support/sql/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (l copyWriter) Write(p []byte) (n int, err error) {
// Filter out kubectl line about terminated exit code
if !strings.HasPrefix(string(p), "command terminated with exit code") {
if _, err := l.Stream.Write(p); err != nil {
return 0, utils.Errorf(err, L("cannot write"))
return 0, utils.Error(err, L("cannot write"))
}

n = len(p)
Expand Down
2 changes: 1 addition & 1 deletion mgradm/cmd/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func newListCmd(globalFlags *types.GlobalFlags, run func(*podmanUpgradeFlags) er

var flags podmanUpgradeFlags
if err := viper.Unmarshal(&flags); err != nil {
return utils.Errorf(err, L("failed to unmarshall configuration"))
return utils.Error(err, L("failed to unmarshall configuration"))
}
if err := run(&flags); err != nil {
return err
Expand Down
6 changes: 3 additions & 3 deletions mgradm/shared/coco/coco.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func writeCocoServiceFiles(

cocoImage, err := utils.ComputeImage(baseImage.Registry.Host, baseImage.Tag, image)
if err != nil {
return utils.Errorf(err, L("failed to compute image URL"))
return utils.Error(err, L("failed to compute image URL"))
}

pullEnabled := (cocoFlags.Replicas > 0 && cocoFlags.IsChanged) || (currentReplicas > 0 && !cocoFlags.IsChanged)
Expand All @@ -96,7 +96,7 @@ func writeCocoServiceFiles(

if err := utils.WriteTemplateToFile(attestationData,
podman.GetServicePath(podman.ServerAttestationService+"@"), 0555, true); err != nil {
return utils.Errorf(err, L("failed to generate systemd service unit file"))
return utils.Error(err, L("failed to generate systemd service unit file"))
}

environment := fmt.Sprintf(`Environment=UYUNI_SERVER_ATTESTATION_IMAGE=%s
Expand All @@ -106,7 +106,7 @@ Environment=database_connection=jdbc:postgresql://%s:%d/%s
if err := podman.GenerateSystemdConfFile(
podman.ServerAttestationService+"@", podman.GeneratedConf, environment, true,
); err != nil {
return utils.Errorf(err, L("cannot generate systemd conf file"))
return utils.Error(err, L("cannot generate systemd conf file"))
}

if err := systemd.ReloadDaemon(false); err != nil {
Expand Down
10 changes: 5 additions & 5 deletions mgradm/shared/hub/xmlrpcapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func SetupHubXmlrpc(
hubXmlrpcImage, err := utils.ComputeImage(baseImage.Registry.Host, baseImage.Tag, image)

if err != nil {
return utils.Errorf(err, L("failed to compute image URL"))
return utils.Error(err, L("failed to compute image URL"))
}

preparedImage, err := podman.PrepareImage(authFile, hubXmlrpcImage, baseImage.PullPolicy, pullEnabled)
Expand All @@ -50,7 +50,7 @@ func SetupHubXmlrpc(
}

if err := generateHubXmlrpcSystemdService(systemd, preparedImage, podman.ServerContainerName); err != nil {
return utils.Errorf(err, L("cannot generate systemd service"))
return utils.Error(err, L("cannot generate systemd service"))
}

if err := EnableHubXmlrpc(systemd, hubXmlrpcFlags.Replicas); err != nil {
Expand All @@ -69,7 +69,7 @@ func EnableHubXmlrpc(systemd podman.Systemd, replicas int) error {

if replicas > 0 {
if err := systemd.ScaleService(replicas, podman.HubXmlrpcService); err != nil {
return utils.Errorf(err, L("cannot enable service"))
return utils.Error(err, L("cannot enable service"))
}
}
return nil
Expand Down Expand Up @@ -116,14 +116,14 @@ func generateHubXmlrpcSystemdService(systemd podman.Systemd, image string, serve
if err := utils.WriteTemplateToFile(
hubXmlrpcData, podman.GetServicePath(podman.HubXmlrpcService+"@"), 0555, true,
); err != nil {
return utils.Errorf(err, L("failed to generate systemd service unit file"))
return utils.Error(err, L("failed to generate systemd service unit file"))
}

environment := fmt.Sprintf("Environment=UYUNI_HUB_XMLRPC_IMAGE=%s", image)
if err := podman.GenerateSystemdConfFile(
podman.HubXmlrpcService+"@", podman.GeneratedConf, environment, true,
); err != nil {
return utils.Errorf(err, L("cannot generate systemd conf file"))
return utils.Error(err, L("cannot generate systemd conf file"))
}

return systemd.ReloadDaemon(false)
Expand Down
Loading
Loading