Giuseppe Lavagetto has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/399210 )
Change subject: puppet-compiler: fix facts update process ...................................................................... puppet-compiler: fix facts update process - Various fixes to the script for refreshing facts - Set expiration of the facts cache to one year from now Change-Id: I9737164897a9548213a7d7aaa1fe5f3577a97a24 --- M modules/puppet_compiler/files/compiler-update-facts M modules/puppetmaster/files/puppet-facts-export.py 2 files changed, 4 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/10/399210/1 diff --git a/modules/puppet_compiler/files/compiler-update-facts b/modules/puppet_compiler/files/compiler-update-facts index 215e92c..548e405 100755 --- a/modules/puppet_compiler/files/compiler-update-facts +++ b/modules/puppet_compiler/files/compiler-update-facts @@ -13,20 +13,19 @@ require 'safe_yaml' SafeYAML::OPTIONS[:default_mode] = :safe a = YAML.load(STDIN.read)['puppetmaster::servers'] -puts a.map{|k, v| a[k].map {|v| v['worker']}}.flatten().join(' ') +puts a.map{|k, v| a[k].map {|v| v['worker']}}.flatten()[0] RUBY_SCRIPT ) -MASTERS=${PUPPET_MASTERS:-$(ruby -e "${RUBY_SCRIPT}" < hieradata/common/puppetmaster.yaml)} ssh "$COMPILER" 'sudo rm -rf /tmp/facts; sudo mkdir -p /tmp/facts' # Gather all the facts from one of the masters. -master=$MASTERS[0] +master=${PUPPET_MASTERS:-$(ruby -e "${RUBY_SCRIPT}" < hieradata/common/puppetmaster.yaml)} echo -e "\n### Syncing facts from $master" ssh "$master" 'sudo /usr/local/bin/puppet-facts-export 1>/dev/null' # tunnel via your localhost without ever the file touching the disk ssh "$master" cat /tmp/puppet-facts-export.tar.xz | ssh "$COMPILER" 'cat > puppet-facts-export.tar.xz' ssh "$master" 'sudo rm /tmp/puppet-facts-export.tar.xz' -ssh "$COMPILER" 'tar Jxf puppet-facts-export.tar.xz --directory /tmp/facts && sudo chown -R jenkins-deploy:wikidev /tmp/facts/yaml' +ssh "$COMPILER" 'sudo tar Jxf puppet-facts-export.tar.xz --directory /tmp/facts && sudo chown -R jenkins-deploy:wikidev /tmp/facts/yaml' # Finally, copy all the facts to destination and cleanup ssh "$COMPILER" 'sudo rsync --delete -au /tmp/facts/yaml/ /var/lib/catalog-differ/puppet/yaml/ && sudo rm -rf /tmp/facts' diff --git a/modules/puppetmaster/files/puppet-facts-export.py b/modules/puppetmaster/files/puppet-facts-export.py index b34509b..413a430 100755 --- a/modules/puppetmaster/files/puppet-facts-export.py +++ b/modules/puppetmaster/files/puppet-facts-export.py @@ -30,7 +30,7 @@ date_format = '%Y-%m-%d %H:%M:%S.%s +00:00' datetime_facts = datetime.utcnow() ts = datetime_facts.strftime(date_format) - exp = (datetime_facts + timedelta(days=1)).strftime(date_format) + exp = (datetime_facts + timedelta(days=365)).strftime(date_format) outfile = '/tmp/puppet-facts-export.tar.xz' tmpdir = tempfile.mkdtemp(dir='/tmp', prefix='puppetdb-export') -- To view, visit https://gerrit.wikimedia.org/r/399210 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9737164897a9548213a7d7aaa1fe5f3577a97a24 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Giuseppe Lavagetto <glavage...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits