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.11-* | 21 Pin: version 2.7.26-* |
22 Pin-Priority: 1000''' | 22 Pin-Priority: 501''' |
23 | 23 |
24 PUPPETLABS_GPG_KEY = ''' | 24 PUPPETLABS_GPG_KEY = ''' |
25 -----BEGIN PGP PUBLIC KEY BLOCK----- | 25 -----BEGIN PGP PUBLIC KEY BLOCK----- |
26 Version: GnuPG v1.4.12 (GNU/Linux) | 26 Version: GnuPG v1.4.12 (GNU/Linux) |
27 Comment: GPGTools - http://gpgtools.org | 27 Comment: GPGTools - http://gpgtools.org |
28 | 28 |
29 mQINBEw3u0ABEAC1+aJQpU59fwZ4mxFjqNCgfZgDhONDSYQFMRnYC1dzBpJHzI6b | 29 mQINBEw3u0ABEAC1+aJQpU59fwZ4mxFjqNCgfZgDhONDSYQFMRnYC1dzBpJHzI6b |
30 fUBQeaZ8rh6N4kZ+wq1eL86YDXkCt4sCvNTP0eF2XaOLbmxtV9bdpTIBep9bQiKg | 30 fUBQeaZ8rh6N4kZ+wq1eL86YDXkCt4sCvNTP0eF2XaOLbmxtV9bdpTIBep9bQiKg |
31 5iZaz+brUZlFk/MyJ0Yz//VQ68N1uvXccmD6uxQsVO+gx7rnarg/BGuCNaVtGwy+ | 31 5iZaz+brUZlFk/MyJ0Yz//VQ68N1uvXccmD6uxQsVO+gx7rnarg/BGuCNaVtGwy+ |
32 S98g8Begwxs9JmGa8pMCcSxtC7fAfAEZ02cYyrw5KfBvFI3cHDdBqrEJQKwKeLKY | 32 S98g8Begwxs9JmGa8pMCcSxtC7fAfAEZ02cYyrw5KfBvFI3cHDdBqrEJQKwKeLKY |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 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) |
88 add_key_process.communicate(PUPPETLABS_GPG_KEY) | 88 add_key_process.communicate(PUPPETLABS_GPG_KEY) |
89 | 89 |
90 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: |
91 handle.write(PUPPETLABS_SOURCES) | 91 handle.write(PUPPETLABS_SOURCES) |
92 | 92 |
93 with io.open('/etc/apt/preferences.d/puppetlabs', 'wb') as handle: | 93 with io.open('/etc/apt/preferences.d/puppetlabs', 'wb') as handle: |
94 handle.write(PUPPETLABS_PREFS) | 94 handle.write(PUPPETLABS_PREFS) |
95 | 95 |
96 subprocess.check_call(['apt-get', '-y', 'update']) | 96 subprocess.check_call(['apt-get', '-y', 'update']) |
97 subprocess.check_call(['apt-get', '-y', 'install', 'puppet']) | 97 subprocess.check_call(['apt-get', '-y', 'install', |
98 subprocess.check_call(['apt-get', '-y', 'install', 'hiera-puppet']) | 98 '-o', 'Dpkg::Options::=--force-overwrite', |
| 99 'puppet', 'puppet-common', 'hiera-puppet']) |
99 | 100 |
100 if not os.path.exists('/etc/puppet/hiera.yaml'): | 101 if not os.path.exists('/etc/puppet/hiera.yaml'): |
101 realpath = os.path.realpath(__file__) | 102 realpath = os.path.realpath(__file__) |
102 dirname = os.path.dirname(realpath) | 103 dirname = os.path.dirname(realpath) |
103 config = os.path.join(dirname, 'hiera.yaml') | 104 config = os.path.join(dirname, 'hiera.yaml') |
104 if os.path.exists(config): | 105 if os.path.exists(config): |
105 os.symlink(config, '/etc/puppet/hiera.yaml') | 106 os.symlink(config, '/etc/puppet/hiera.yaml') |
OLD | NEW |