Skip to content

Use spacewalk-hostname-rename from uyuni-update-config service #10352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix spacewalk-hostname-rename with containers (bsc#1229825)
28 changes: 24 additions & 4 deletions spacewalk/admin/uyuni-update-config
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ from spacewalk.server import rhnSQL

def run_uyuni_configfiles_sync():
if not os.path.isfile("/usr/bin/uyuni-configfiles-sync"):
return
return 0

exitCode = 0
result = subprocess.run(
["/usr/bin/uyuni-configfiles-sync", "sync"],
stdout=subprocess.PIPE,
Expand All @@ -39,7 +40,8 @@ def run_uyuni_configfiles_sync():
"Failed to synchronize files to persistent volumes. Aborting!\n"
)
sys.stdout.flush()
sys.exit(1)
exitCode = 1
return exitCode


def move_config_to_db():
Expand Down Expand Up @@ -186,14 +188,32 @@ def change_billing_data_service():
sys.stdout.write("billing-data-service sysconfig: changed LISTEN address\n")


def hostname_check():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function should not be named 'check' when it change something.

result = subprocess.run(
["/usr/bin/spacewalk-hostname-rename"],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
encoding="utf-8",
check=False,
)

if result.returncode:
sys.stdout.write("Failed to rename the server\n")
if result.stdout:
sys.stdout.write(f"{result.stdout}\n")
sys.stdout.flush()
return result.returncode


def main():
run_uyuni_configfiles_sync()
exitCode = run_uyuni_configfiles_sync()
init_scc_login()
import_suma_gpg_keyring()
copy_ca()
move_config_to_db()
change_billing_data_service()

exitCode = max(hostname_check(), exitCode)
return exitCode

if __name__ == "__main__":
sys.exit(abs(main() or 0))
3 changes: 2 additions & 1 deletion spacewalk/admin/uyuni-update-config.service
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[Unit]
Description=Uyuni update config
Before=uyuni-check-database.service tomcat.service apache2.service rhn-search.service taskomatic.service postfix.service
Before=uyuni-check-database.service cobblerd.service tomcat.service apache2.service rhn-search.service taskomatic.service postfix.service

[Service]
PassEnvironment=UYUNI_HOSTNAME
ExecStart=/usr/sbin/uyuni-update-config
Type=oneshot
RemainAfterExit=yes
Loading
Loading