Update software conf package feed dynamically

Software conf is hardcoded right now. So it
needs to be updated after each new master load.
This commit removes the static package feed and
will update the software conf dynamically according
to the version of load and release.

Test Plan:
PASS: Check software.conf is updated with correct
      version after system startup.
PASS: Check software.conf is updated for pre-bootstrap
      case
PASS: Check software.conf file changes persist after
      host lock-unlock

Story: 2010676
Task: 50206
Change-Id: I1a888a59da152a2cd0e6c665d4e33e836ceffd07
Signed-off-by: sshathee <shunmugam.shatheesh@windriver.com>
This commit is contained in:
sshathee 2024-05-28 09:49:28 -04:00
parent 93e0e84e56
commit a2f8ccf7ce
3 changed files with 13 additions and 4 deletions

@ -8,5 +8,3 @@ agent_port = 5495
# alternate PostgreSQL server port for bringing up
# db to run on to-release
alt_postgresql_port = 6666
# todo(cshort): This needs to be configured in puppet.
package_feed="http://controller:8080/updates/debian/rel-24.09/ bullseye updates"

@ -87,8 +87,8 @@ def read_config():
'agent_port': "5495",
'alt_postgresql_port': "6666",
"package_feed":
"http://controller:8080/updates/debian/rel-%s/ bullseye updates"
% constants.STARLINGX_RELEASE,
"http://controller:8080/updates/debian/rel-%s/ %s updates"
% (constants.STARLINGX_RELEASE, constants.DEBIAN_RELEASE),
}
global controller_mcast_group

@ -3545,6 +3545,17 @@ class PatchControllerMainThread(threading.Thread):
def main():
software_conf = constants.SOFTWARE_CONFIG_FILE_LOCAL
pkg_feed = ('"http://controller:8080/updates/debian/rel-%s/ %s updates"'
% (constants.STARLINGX_RELEASE, constants.DEBIAN_RELEASE))
config = configparser.ConfigParser()
config.read(software_conf)
config.set("runtime", "package_feed",pkg_feed)
with open(software_conf, "w+") as configfile:
config.write(configfile)
# The following call to CONF is to ensure the oslo config
# has been called to specify a valid config dir.
# Otherwise oslo_policy will fail when it looks for its files.