From: Robert Waffen Date: Fri, 8 Apr 2022 11:05:28 +0000 (+0200) Subject: remove generate types, will be done in r10k directly X-Git-Tag: 1.7.9~3^2 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=5819c887b9a95b702af84052f0558b85b04369ab;p=pixelpark%2Fpuppetmaster-webhooks.git remove generate types, will be done in r10k directly --- diff --git a/lib/webhooks/r10k.py b/lib/webhooks/r10k.py index 77dac4d..7ba30b1 100644 --- a/lib/webhooks/r10k.py +++ b/lib/webhooks/r10k.py @@ -225,11 +225,6 @@ class R10kHookApp(BaseHookApp): LOG.warn(_("Executing {!r} was not successful.").format(str(self.r10k_bin))) return - if not self.generate_puppet_types(): - what = '{c} generate types --environment {e}'.format(c=self.puppet_bin, e=self.ref) - LOG.warn(_("{!r} was not successful.").format(what)) - return - return self.del_env_cache() finally: @@ -305,47 +300,6 @@ class R10kHookApp(BaseHookApp): self.print_out(msg) return - # ------------------------------------------------------------------------- - def generate_puppet_types(self): - """Generates definitions for custom resource types using Puppet code - for the given environment.""" - - LOG.info(_("Generating Puppet types for environment {e!r} on {h!r}.").format( - e=self.ref, h=self.puppetmaster_host)) - - res = True - - cmd = [ - str(self.puppet_bin), 'generate', 'types', - '--environment', self.ref, - '--color', 'false', ] - - if self.verbose > 1: - cmd.append('--verbose') - if self.verbose > 3: - cmd.append('--debug') - - proc = self.handler.call(cmd, sudo=self.do_sudo, quiet=False) - - if proc.stdout: - msg = _("Output:") + '\n' + proc.stdout - self.print_out(msg) - else: - LOG.debug(_("No output.")) - - if proc.stderr: - cmd_str = ' '.join(map(lambda x: pipes.quote(x), proc.args)) - msg = _("Error messages on {c!r}:\n{e}").format(c=cmd_str, e=proc.stderr) - msg_rc = _("Returncode was {}.").format(proc.returncode) - self.print_out(msg) - if proc.returncode: - self.print_out(msg_rc) - self.error_data.append(msg) - self.error_data.append(msg_rc) - res = False - - return res - # ------------------------------------------------------------------------- def exec_r10k(self): diff --git a/update_puppet5_env b/update_puppet5_env index d5dc73a..c71910c 100755 --- a/update_puppet5_env +++ b/update_puppet5_env @@ -4,14 +4,10 @@ set -e set -u PUPPET_CONF="/etc/puppetlabs/puppet/puppet.conf" -CERTNAME=$(cat /etc/puppetlabs/puppet/puppet.conf | \ - grep -P -v '^\s*#' | \ - grep -P -v '^\s*$' | \ - grep -P -o '^\s*certname(\s|=).*' | \ - awk -F'=' '{print $2}' | \ - sed -e 's/^[ ]*//' -e 's/[ ]*$//') +CERTNAME=$(/opt/puppetlabs/bin/puppet config print certname --section agent) + if [[ -z "${CERTNAME}" ]] ; then - CERTNAME=$(hostname -f) + CERTNAME=$(/opt/puppetlabs/bin/facter networking.fqdn) fi echo @@ -58,10 +54,6 @@ for env in ${envs} ; do echo -e "\nEnvironment-Verzeichnis '${env_dir}' existiert nicht." >&2 fi - cmd="/opt/puppetlabs/puppet/bin/puppet generate types --environment \"${env}\"" - echo "${cmd}" - eval ${cmd} - echo echo "Finished environment '${env}'." sleep 1