Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: hiera/install_precise.py

Issue 6330493855334400: Issue 2155 - Ensure /etc/puppet/hiera.yaml is linked properly (Closed)
Patch Set: Created March 17, 2015, 9:24 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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')
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld