diff --git a/mgradm/cmd/migrate/podman/utils.go b/mgradm/cmd/migrate/podman/utils.go index 663af4837..179cc1425 100644 --- a/mgradm/cmd/migrate/podman/utils.go +++ b/mgradm/cmd/migrate/podman/utils.go @@ -121,7 +121,12 @@ func migrateToPodman(globalFlags *types.GlobalFlags, flags *podmanMigrateFlags, return err } - if err := hub.EnableHubXmlrpc(flags.HubXmlrpc.Replicas); err != nil { + hubReplicas := flags.HubXmlrpc.Replicas + if extractedData.HasHubXmlrpcApi { + log.Info().Msg(L("Enabling Hub XML-RPC API since it is enabled on the migrated server")) + hubReplicas = 1 + } + if err := hub.EnableHubXmlrpc(hubReplicas); err != nil { return err } diff --git a/mgradm/shared/templates/migrateScriptTemplate.go b/mgradm/shared/templates/migrateScriptTemplate.go index 46f43f48c..ad1074f5e 100644 --- a/mgradm/shared/templates/migrateScriptTemplate.go +++ b/mgradm/shared/templates/migrateScriptTemplate.go @@ -95,6 +95,8 @@ grep '^db_password' /etc/rhn/rhn.conf | sed 's/[ \t]//g' >>/var/lib/uyuni-tools/ grep '^db_name' /etc/rhn/rhn.conf | sed 's/[ \t]//g' >>/var/lib/uyuni-tools/data grep '^db_port' /etc/rhn/rhn.conf | sed 's/[ \t]//g' >>/var/lib/uyuni-tools/data +$SSH {{ .SourceFqdn }} sh -c "systemctl list-unit-files | grep hub-xmlrpc-api | grep -q active && echo has_hubxmlrpc=true || echo has_hubxmlrpc=false" >>/var/lib/uyuni-tools/data + echo "Altering configuration for domain resolution..." sed 's/report_db_host = {{ .SourceFqdn }}/report_db_host = localhost/' -i /etc/rhn/rhn.conf; sed 's/server\.jabber_server/java\.hostname/' -i /etc/rhn/rhn.conf; diff --git a/shared/utils/inspector_test.go b/shared/utils/inspector_test.go index 8ba60fdb6..3ae21f449 100644 --- a/shared/utils/inspector_test.go +++ b/shared/utils/inspector_test.go @@ -19,6 +19,7 @@ db_user=myuser db_password=mysecret db_name=mydb db_port=1234 +has_hubxmlrpc=true ` testDir, cleaner := test_utils.CreateTmpFolder(t) @@ -39,4 +40,5 @@ db_port=1234 test_utils.AssertEquals(t, "Invalid DB password", "mysecret", actual.DbPassword) test_utils.AssertEquals(t, "Invalid DB name", "mydb", actual.DbName) test_utils.AssertEquals(t, "Invalid DB port", 1234, actual.DbPort) + test_utils.AssertTrue(t, "HasHubXmlrpcApi should be true", actual.HasHubXmlrpcApi) } diff --git a/shared/utils/utils.go b/shared/utils/utils.go index 251212567..d942857cb 100644 --- a/shared/utils/utils.go +++ b/shared/utils/utils.go @@ -41,6 +41,7 @@ var fqdnValid = regexp.MustCompile(`^([a-zA-Z0-9]{1}[a-zA-Z0-9-]{0,62})(\.[a-zA- type InspectResult struct { CommonInspectData `mapstructure:",squash"` Timezone string + HasHubXmlrpcApi bool `mapstructure:"has_hubxmlrpc"` } func checkValueSize(value string, min int, max int) bool {