| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 import distutils.spawn | 3 import distutils.spawn |
| 4 import io | 4 import io |
| 5 import os | 5 import os |
| 6 import subprocess | 6 import subprocess |
| 7 import sys | 7 import sys |
| 8 | 8 |
| 9 if distutils.spawn.find_executable('puppet') \ | 9 if distutils.spawn.find_executable('puppet') \ |
| 10 and distutils.spawn.find_executable('hiera'): | 10 and distutils.spawn.find_executable('hiera'): |
| 11 sys.exit(os.EX_OK) | 11 sys.exit(os.EX_OK) |
| 12 | 12 |
| 13 PUPPETLABS_SOURCES = ''' | 13 PUPPETLABS_SOURCES = ''' |
| 14 deb http://apt.puppetlabs.com precise main | 14 deb http://apt.puppetlabs.com precise main |
| 15 deb-src http://apt.puppetlabs.com precise main''' | 15 deb-src http://apt.puppetlabs.com precise main''' |
| 16 | 16 |
| 17 PUPPETLABS_PREFS = ''' | 17 PUPPETLABS_PREFS = ''' |
| 18 # Puppetlabs packages (e.g. hiera) would attempt to install a puppet 3.x | 18 # Puppetlabs packages (e.g. hiera) would attempt to install a puppet 3.x |
| 19 # or later release (which is not available in precise) if not pinned here | 19 # or later release (which is not available in precise) if not pinned here |
| 20 Package: puppet puppet-common | 20 Package: puppet puppet-common |
| 21 Pin: version 2.7.26-* | 21 Pin: version 2.7.26-* |
| 22 Pin-Priority: 501 | |
| 23 | |
| 24 # See https://issues.adblockplus.org/ticket/3706#comment:4 | |
| 25 Package: facter | |
| 26 Pin: version 1.* | |
| 27 Pin-Priority: 501''' | 22 Pin-Priority: 501''' |
| 28 | 23 |
| 29 PUPPETLABS_GPG_KEY = ''' | 24 PUPPETLABS_GPG_KEY = ''' |
| 30 -----BEGIN PGP PUBLIC KEY BLOCK----- | 25 -----BEGIN PGP PUBLIC KEY BLOCK----- |
| 31 Version: GnuPG v1.4.12 (GNU/Linux) | 26 Version: GnuPG v1.4.12 (GNU/Linux) |
| 32 Comment: GPGTools - http://gpgtools.org | 27 Comment: GPGTools - http://gpgtools.org |
| 33 | 28 |
| 34 mQINBEw3u0ABEAC1+aJQpU59fwZ4mxFjqNCgfZgDhONDSYQFMRnYC1dzBpJHzI6b | 29 mQINBEw3u0ABEAC1+aJQpU59fwZ4mxFjqNCgfZgDhONDSYQFMRnYC1dzBpJHzI6b |
| 35 fUBQeaZ8rh6N4kZ+wq1eL86YDXkCt4sCvNTP0eF2XaOLbmxtV9bdpTIBep9bQiKg | 30 fUBQeaZ8rh6N4kZ+wq1eL86YDXkCt4sCvNTP0eF2XaOLbmxtV9bdpTIBep9bQiKg |
| 36 5iZaz+brUZlFk/MyJ0Yz//VQ68N1uvXccmD6uxQsVO+gx7rnarg/BGuCNaVtGwy+ | 31 5iZaz+brUZlFk/MyJ0Yz//VQ68N1uvXccmD6uxQsVO+gx7rnarg/BGuCNaVtGwy+ |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 DHmg7unCk4JyVopQ2KHMoqG886elu+rm0ASkhyqBAk9sWKptMl3NHiYTRE/m9VAk | 81 DHmg7unCk4JyVopQ2KHMoqG886elu+rm0ASkhyqBAk9sWKptMl3NHiYTRE/m9VAk |
| 87 ugVIB2pi+8u84f+an4Hml4xlyijgYu05pqNvnLRyJDLd61hviLC8GYU= | 82 ugVIB2pi+8u84f+an4Hml4xlyijgYu05pqNvnLRyJDLd61hviLC8GYU= |
| 88 =a34C | 83 =a34C |
| 89 -----END PGP PUBLIC KEY BLOCK----- | 84 -----END PGP PUBLIC KEY BLOCK----- |
| 90 ''' | 85 ''' |
| 91 | 86 |
| 92 add_key_process = subprocess.Popen(['apt-key', 'add', '-'], stdin=subprocess.PIP
E) | 87 add_key_process = subprocess.Popen(['apt-key', 'add', '-'], stdin=subprocess.PIP
E) |
| 93 add_key_process.communicate(PUPPETLABS_GPG_KEY) | 88 add_key_process.communicate(PUPPETLABS_GPG_KEY) |
| 94 | 89 |
| 95 with io.open('/etc/apt/sources.list.d/puppetlabs.list', 'wb') as handle: | 90 with io.open('/etc/apt/sources.list.d/puppetlabs.list', 'wb') as handle: |
| 96 handle.write(PUPPETLABS_SOURCES) | 91 handle.write(PUPPETLABS_SOURCES) |
| 97 | 92 |
| 98 with io.open('/etc/apt/preferences.d/puppetlabs', 'wb') as handle: | 93 with io.open('/etc/apt/preferences.d/puppetlabs', 'wb') as handle: |
| 99 handle.write(PUPPETLABS_PREFS) | 94 handle.write(PUPPETLABS_PREFS) |
| 100 | 95 |
| 101 subprocess.check_call(['apt-get', '-y', 'update']) | 96 subprocess.check_call(['apt-get', '-y', 'update']) |
| 102 subprocess.check_call(['apt-get', '-y', 'install', | 97 subprocess.check_call(['apt-get', '-y', 'install', |
| 103 '-o', 'Dpkg::Options::=--force-overwrite', | 98 '-o', 'Dpkg::Options::=--force-overwrite', |
| 104 'puppet', 'puppet-common', 'hiera-puppet']) | 99 'puppet', 'puppet-common', 'hiera-puppet']) |
| 105 | 100 |
| 106 if not os.path.exists('/etc/puppet/hiera.yaml'): | 101 if not os.path.exists('/etc/puppet/hiera.yaml'): |
| 107 realpath = os.path.realpath(__file__) | 102 realpath = os.path.realpath(__file__) |
| 108 dirname = os.path.dirname(realpath) | 103 dirname = os.path.dirname(realpath) |
| 109 config = os.path.join(dirname, 'hiera.yaml') | 104 config = os.path.join(dirname, 'hiera.yaml') |
| 110 if os.path.exists(config): | 105 if os.path.exists(config): |
| 111 os.symlink(config, '/etc/puppet/hiera.yaml') | 106 os.symlink(config, '/etc/puppet/hiera.yaml') |
| OLD | NEW |