diff --git a/confluent_osdeploy/el7/profiles/default/scripts/add_local_repositories b/confluent_osdeploy/el7/profiles/default/scripts/add_local_repositories new file mode 100644 index 00000000..e0c79d3b --- /dev/null +++ b/confluent_osdeploy/el7/profiles/default/scripts/add_local_repositories @@ -0,0 +1,34 @@ +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: + 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)) + repopath = c[sec]['repository'] + if repopath[0] = '.': + repopath = repopath[1:] + 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/el7/profiles/default/scripts/post.sh b/confluent_osdeploy/el7/profiles/default/scripts/post.sh index d235598b..cc21d46b 100644 --- a/confluent_osdeploy/el7/profiles/default/scripts/post.sh +++ b/confluent_osdeploy/el7/profiles/default/scripts/post.sh @@ -15,6 +15,11 @@ 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.