diff --git a/confluent_osdeploy/el8-diskless/profiles/default/scripts/add_local_repositories b/confluent_osdeploy/el8-diskless/profiles/default/scripts/add_local_repositories new file mode 100644 index 00000000..2e128b47 --- /dev/null +++ b/confluent_osdeploy/el8-diskless/profiles/default/scripts/add_local_repositories @@ -0,0 +1,43 @@ +try: + import configparser +except ImportError: + import ConfigParser as configparser + import cStringIO +import imp +import sys +apiclient = imp.load_source('apiclient', '/opt/confluent/bin/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() +try: + c.read_string(cfgdata) +except AttributeError: + f = cStringIO.StringIO(cfgdata) + c.readfp(f) +for sec in c.sections(): + if sec.startswith('variant-'): + try: + repopath = c.get(sec, 'repository') + except Exception: + 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)) + if repopath[0] == '.': + repopath = repopath[1:] + repout.write('baseurl=https://{}/confluent-public/os/{}/distribution/{}\n'.format(server, profile, repopath)) + repout.write('enabled=1\n') diff --git a/confluent_osdeploy/el8-diskless/profiles/default/scripts/onboot.sh b/confluent_osdeploy/el8-diskless/profiles/default/scripts/onboot.sh index cf86a281..1bc7d8c4 100644 --- a/confluent_osdeploy/el8-diskless/profiles/default/scripts/onboot.sh +++ b/confluent_osdeploy/el8-diskless/profiles/default/scripts/onboot.sh @@ -19,6 +19,9 @@ chmod 600 /var/log/confluent/confluent-onboot.log tail -f /var/log/confluent/confluent-onboot.log > /dev/console & logshowpid=$! +rpm --import /etc/pki/rpm-gpg/* + +run_remote_python add_local_repositories run_remote_python syncfileclient run_remote_python confignet