Skip to content

server_containerized: wait_for_mgr_sync.sh loops indefinitely when no SCC credentials are provided #2091

Description

@libkush

When deploying a containerized Uyuni server without SCC credentials (which is the normal case for Uyuni, SCC is only required for SUSE Manager), the scc_data_refresh Salt state runs wait_for_mgr_sync.sh which loops indefinitely, blocking tofu apply forever.

Environment

  • Host OS: openSUSE Tumbleweed
  • Backend: libvirt (local)
  • product_version: uyuni-master
  • OpenTofu version: v1.11.5

main.tf:

terraform {
 required_version = ">= 1.6.0"
 required_providers {
   libvirt = {
     source = "dmacvicar/libvirt"
     version = "0.8.3"
   }
 }
}

provider "libvirt" {
  uri = "qemu:///system"
}

module "base" {
  source = "./modules/base"
  product_version = "uyuni-master"
  domain = "local"
  ssh_key_path    = "~/.ssh/id_ed25519.pub"
  images = ["opensuse156o", "tumbleweedo"]
}

module "server" {
  source = "./modules/server_containerized"
  base_configuration = module.base.configuration
  name = "server"
  create_sample_bootstrap_script = false

  provider_settings = {
    memory = 4096
    vcpu   = 4
  }
}

module "minion" {
  source = "./modules/minion"
  base_configuration = module.base.configuration

  name = "minion"
  image = "opensuse156o"
  server_configuration = module.server.configuration

  provider_settings = {
    memory = 1024
    vcpu   = 2
  }
}

Steps to reproduce

cp main.tf.libvirt.example main.tf
# edit main.tf as above — note: no cc_username or cc_password set
cd modules && ln -sfn ../backend_modules/libvirt backend
tofu init
tofu apply

Observed behavior:

After mgradm install completes successfully, the provisioning hangs indefinitely with output like:

(remote-exec): Waiting for mgr-sync refresh to finish...
(remote-exec): ...not finished yet...
(remote-exec): Refreshing Channel families
(remote-exec):   Error: <Fault 10104: 'redstone.xmlrpc.XmlRpcFault: No SCC organization credentials found.'>
(remote-exec):              [DONE]
(remote-exec): Refreshing SUSE products                       [FAIL]
(remote-exec): ...not finished yet...
(remote-exec): Refreshing Channel families
(remote-exec):   Error: <Fault 10104: 'redstone.xmlrpc.XmlRpcFault: No SCC organization credentials found.'>
...

This repeats forever. tofu apply never completes and must be killed manually.

Root cause

The scc_data_refresh state in salt/server_containerized/initial_content.sls runs unconditionally:

scc_data_refresh:
  cmd.script:
    - name: salt://server_containerized/wait_for_mgr_sync.sh
    - use_vt: True
    - args: "{{ server_username }} {{ server_password }}"
    - require:
      - cmd: mgradm_install

wait_for_mgr_sync.sh polls mgr-sync in a loop waiting for channel and product sync to complete. Without SCC credentials, the sync always fails with No SCC organization credentials found, so the loop never exits.
The cc_username grain is available and is null for Uyuni deployments, but the state has no condition to skip when credentials are absent.

Fix

The correct fix should be to use Jinja's or operator to coerce null to an empty string before the check:

scc_data_refresh:
   cmd.script:
     - name: salt://server_containerized/wait_for_mgr_sync.sh
     - use_vt: True
     - args: "{{ server_username }} {{ server_password }}"
     - require:
       - cmd: mgradm_install
+    - unless: test -z "{{ grains.get('cc_username') or '' }}"

This will skip the sync wait when cc_username is null or empty, while still running it for SUSE Manager deployments where SCC credentials are provided.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions