| Left: | ||
| Right: |
| 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'): |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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', 'puppet']) |
| 98 subprocess.check_call(['apt-get', '-y', 'install', 'hiera-puppet']) | 98 subprocess.check_call(['apt-get', '-y', 'install', 'hiera-puppet']) |
| 99 | 99 |
| 100 if not os.path.exists('/etc/puppet/hiera.yaml'): | 100 if not os.path.exists('/etc/puppet/hiera.yaml'): |
| 101 config = os.path.join(os.path.dirname(__file__), 'hiera.yaml') | 101 realpath = os.path.realpath(__file__) |
|
Felix Dahlke
2015/03/17 09:33:50
Trailing slash, huh? :)
mathias
2015/03/17 09:41:01
Indeed :)
| |
| 102 dirname = os.path.dirname(realpath) | |
| 103 config = os.path.join(dirname, 'hiera.yaml') | |
| 102 if os.path.exists(config): | 104 if os.path.exists(config): |
| 103 os.symlink(config, '/etc/puppet/hiera.yaml') | 105 os.symlink(config, '/etc/puppet/hiera.yaml') |
| OLD | NEW |