From 3812fc93ff28417eac2c35d0cb4302df8ef8e769 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 6 Aug 2020 16:37:18 -0400 Subject: [PATCH] Have EL8 family add repositories manually --- .../default/scripts/add_local_repositories | 32 +++++++++++++++++++ .../el8/profiles/default/scripts/post.sh | 6 ++++ 2 files changed, 38 insertions(+) create mode 100644 confluent_osdeploy/el8/profiles/default/scripts/add_local_repositories diff --git a/confluent_osdeploy/el8/profiles/default/scripts/add_local_repositories b/confluent_osdeploy/el8/profiles/default/scripts/add_local_repositories new file mode 100644 index 00000000..b9bf82b4 --- /dev/null +++ b/confluent_osdeploy/el8/profiles/default/scripts/add_local_repositories @@ -0,0 +1,32 @@ +import configparser +import imp +import sys +apiclient = imp.load_source('apiclient', '/etc/confluent/apiclient') +repo = None +server = None +profile = None +with open('/etc/confluent/confluent.deploycfg') as dplcfgfile: + lines = dplcfgfile.read().split('\n') + for line in lines: + print(repr(line)) + if line.startswith('deploy_server:'): + _, server = line.split(' ', 1) + if line.startswith('profile: '): + _, profile = line.split(' ', 1) + +path = '/confluent-public/os/{0}/distribution/'.format(profile) +clnt = apiclient.HTTPSClient() +cfgdata = clnt.grab_url(path + '.treeinfo').decode() +c = configparser.ConfigParser() +c.read_string(cfgdata) +for sec in c.sections(): + if sec.startswith('variant-'): + if 'repository' not in c[sec]: + continue + _, varname = sec.split('-', 1) + reponame = '/etc/yum.repos.d/local-{0}.repo'.format(varname.lower()) + with open(reponame, 'w') as repout: + repout.write('[local-{0}]\n'.format(varname.lower())) + repout.write('name=Local install repository for {0}\n'.format(varname)) + repout.write('baseurl=https://{}/confluent-public/os/{}/distribution/{}\n'.format(server, profile, c[sec]['repository'])) + repout.write('enabled=1\n') diff --git a/confluent_osdeploy/el8/profiles/default/scripts/post.sh b/confluent_osdeploy/el8/profiles/default/scripts/post.sh index 383334a1..ed7ee9b4 100644 --- a/confluent_osdeploy/el8/profiles/default/scripts/post.sh +++ b/confluent_osdeploy/el8/profiles/default/scripts/post.sh @@ -14,6 +14,12 @@ curl -X POST -d 'status: staged' -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUEN if [ -f /tmp/cryptboot ]; then run_remote tpm_luks.sh fi + +# By default, the install repository is ignored, change +# this by manually adding local repositories + +rpm --import /etc/pki/rpm-gpg/RPM_GPG_KEY-* +run_remote_python add_local_repositories # This script will execute in the installed system, but using the installer kernel prior to reboot. # This is an appropriate place to run post install activities that do not require the actual installed # kernel to run. For example adding drivers that would be needed for first boot to run cleanly.