]> Frank Brehm's Git Trees - pixelpark/puppetmaster-webhooks.git/commitdiff
remove generate types, will be done in r10k directly
authorRobert Waffen <rw@betadots.de>
Fri, 8 Apr 2022 11:05:28 +0000 (13:05 +0200)
committerRobert Waffen <rw@betadots.de>
Fri, 8 Apr 2022 11:05:28 +0000 (13:05 +0200)
lib/webhooks/r10k.py
update_puppet5_env

index 77dac4d5186d3d05ebc7e91e1d87ee98f23d96c1..7ba30b10632e81b587adeb66142129999881127b 100644 (file)
@@ -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):
 
index d5dc73acd9efec657616b3b9133f9158d7a3b26c..c71910ca9531e4acc7a69a90a59c7c2a994c2236 100755 (executable)
@@ -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