Skip to content

Commit

Permalink
remove client_config_update
Browse files Browse the repository at this point in the history
  • Loading branch information
mbussolotto committed Aug 2, 2023
1 parent ecf5c9c commit a480723
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 233 deletions.
10 changes: 1 addition & 9 deletions spacewalk/certs-tools/Makefile.certs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

SUBDIR = certs
FILES = __init__ rhn_ssl_tool sslToolCli sslToolConfig sslToolLib \
timeLib rhn_bootstrap rhn_bootstrap_strings client_config_update \
timeLib rhn_bootstrap rhn_bootstrap_strings \
mgr_ssl_cert_setup
INSTALL_ROOT_FILES = gen-rpm.sh sign.sh update-ca-cert-trust.sh

Expand Down Expand Up @@ -51,17 +51,9 @@ install :: $(SBINFILES) $(BINFILES) $(PYBINFILES) $(MANS) $(PREFIX)/$(MANDIR)
$(INSTALL_BIN) $(f) $(PREFIX)$(BINDIR)/$(f) ; )
$(foreach f,$(PYBINFILES), \
$(INSTALL_BIN) $(f) $(PREFIX)$(BINDIR)/$(f)-$(PYTHONVERSION) ; )

install :: instClientScript
@$(foreach f,$(INSTALL_ROOT_FILES), \
$(INSTALL_DATA) $(f) $(PREFIX)$(ROOT)/$(SUBDIR)/$(f) ; )

# note: this file is in two places. One in the RPM and one in pub/bootstrap/
instClientScript: $(PUB_BOOTSTRAP_DIR)/client_config_update.py

$(PUB_BOOTSTRAP_DIR)/client_config_update.py : $(PREFIX)/$(PUB_BOOTSTRAP_DIR) client_config_update.py
install -m 0755 client_config_update.py $(PREFIX)/$@

%.$(MANSECT) : %.sgml
/usr/bin/docbook2man $<

Expand Down
216 changes: 0 additions & 216 deletions spacewalk/certs-tools/client_config_update.py

This file was deleted.

1 change: 0 additions & 1 deletion spacewalk/certs-tools/mgr-bootstrap.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@
<RefSect1><Title>Files</Title>
<simplelist>
<member>/usr/bin/mgr-bootstrap</member>
<member>/usr/bin/client_config_update.py</member>
<member>/usr/bin/client-config-overrides.txt</member>
</simplelist>
</RefSect1>
Expand Down
44 changes: 41 additions & 3 deletions spacewalk/certs-tools/rhn_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
## local imports
from uyuni.common import rhn_rpm
from spacewalk.common.rhnConfig import CFG, initCFG
from .client_config_update import readConfigFile
from .rhn_bootstrap_strings import \
getHeader, getGPGKeyImportSh, \
getCorpCACertSh, getRegistrationStackSh, \
Expand Down Expand Up @@ -83,6 +82,47 @@
errnoCANotFound = 16
errnoGPGNotFound = 17

def _parseConfigLine(line):
"""parse a line from a config file. Format can be either "key=value\n"
or "whatever text\n"
return either:
(key, value)
or
None
The '\n' is always stripped from the value.
"""

kv = line.decode('utf8').split('=')
if len(kv) < 2:
# not a setting
return None

if len(kv) > 2:
# '=' is part of the value, need to rejoin it.
kv = [kv[0], '='.join(kv[1:])]

if kv[0].find('[comment]') > 0:
# comment; not a setting
return None

# it's a setting, trim the '\n' and return the (key, value) pair.
kv[0] = kv[0].strip()
kv[1] = kv[1].strip()
return tuple(kv)

def readConfigFile(configFile):
"read in config file, return dictionary of key/value pairs"

fin = open(configFile, 'rb')

d = {}

for line in fin.readlines():
kv = _parseConfigLine(line)
if kv:
d[kv[0]] = kv[1]
return d

# should come out of common code when we move this code out of
# rhns-certs-tools
Expand Down Expand Up @@ -498,8 +538,6 @@ def writeClientConfigOverrides(options):
fout.write("""\
# RHN Client (rhn_register/up2date) config-overrides file v4.0
#
# To be used only in conjuction with client_config_update.py
#
# This file was autogenerated.
#
# The simple rules:
Expand Down
3 changes: 1 addition & 2 deletions spacewalk/certs-tools/spacewalk-certs-tools.spec
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ sed -i 's|etc/httpd/conf|etc/apache2|g' ssl-howto.txt
%install
install -d -m 755 $RPM_BUILD_ROOT/%{rhnroot}/certs

sed -i '1s|python\b|python3|' rhn-ssl-tool mgr-package-rpm-certificate-osimage rhn-bootstrap client_config_update.py
sed -i '1s|python\b|python3|' rhn-ssl-tool mgr-package-rpm-certificate-osimage rhn-bootstrap
make -f Makefile.certs install PREFIX=$RPM_BUILD_ROOT ROOT=%{rhnroot} \
PYTHONPATH=%{python3_sitelib} PYTHONVERSION=%{python3_version} \
MANDIR=%{_mandir} PUB_BOOTSTRAP_DIR=%{pub_bootstrap_dir}
Expand Down Expand Up @@ -126,7 +126,6 @@ ln -s spacewalk-ssh-push-init $RPM_BUILD_ROOT/%{_sbindir}/mgr-ssh-push-init
%doc %{_mandir}/man1/mgr-*.1*
%doc ssl-howto-simple.txt ssl-howto.txt
%license LICENSE
%{pub_bootstrap_dir}/client_config_update.py*
%dir %{rhnroot}
%dir %{pub_dir}
%dir %{pub_bootstrap_dir}
Expand Down
4 changes: 2 additions & 2 deletions spacewalk/certs-tools/spacewalk-ssh-push-init
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ if [ "${USE_TUNNEL}" = "Y" ]; then
exit_in_case_of_error

echo "* Cleaning up temporary files"
ssh -i ${SSH_IDENTITY} ${OPTIONS} ${USER}@${CLIENT} "rm -fv enable.sh bootstrap.sh client-config-overrides-tunnel.txt client_config_update.py"
ssh -i ${SSH_IDENTITY} ${OPTIONS} ${USER}@${CLIENT} "rm -fv enable.sh bootstrap.sh client-config-overrides-tunnel.txt"
cleanup_temp_files
elif [ -n "${BOOTSTRAP}" ]; then
# Simple registration with given bootstrap script
Expand All @@ -278,5 +278,5 @@ elif [ -n "${BOOTSTRAP}" ]; then
exit_in_case_of_error

echo "* Cleaning up temporary files remotely"
ssh -i ${SSH_IDENTITY} ${OPTIONS} ${USER}@${CLIENT} "rm -fv bootstrap.sh client-config-overrides.txt client_config_update.py"
ssh -i ${SSH_IDENTITY} ${OPTIONS} ${USER}@${CLIENT} "rm -fv bootstrap.sh client-config-overrides.txt"
fi

0 comments on commit a480723

Please sign in to comment.