Improving reprepro distributions config file creation

This commit introduces try-catch statement to caputre
any errors during creation of distributions config
file.

PASS: Run software-controller-init.sh and check
      user.log

Story: 2010676
Task: 51179
Change-Id: I78d8b9e9da5f28e622da72a4c7fb3b6897bb8020
Signed-off-by: sshathee <shunmugam.shatheesh@windriver.com>
This commit is contained in:
sshathee
2024-10-16 05:24:13 -04:00
parent 27a77cfe84
commit 22dc364545

View File

@@ -46,16 +46,20 @@ class Repo:
sys.exit(1)
else:
self.logging.info("Creating reprepro configuration.")
config.write_text(
textwrap.dedent(f"""\
Origin: {self.state.origin}
Label: {self.label}
Codename: {self.state.release}
Architectures: amd64
Components: {self.state.origin}
Description: {self.description}
""")
)
try:
config.write_text(
textwrap.dedent(f"""\
Origin: {self.state.origin}
Label: {self.label}
Codename: {self.state.release}
Architectures: amd64
Components: {self.state.origin}
Description: {self.description}
""")
)
except Exception as e:
self.logging.error("Error writing distributions \
config file: %s" % str(e))
options = self.repo.joinpath("options")
if not options.exists():
options.write_text(