Merge lp:~allenap/maas/alt-fix-for-maas_lp1040047 into lp:maas/trunk

Proposed by Gavin Panella on 2012-08-22
Status: Merged
Approved by: Julian Edwards on 2012-08-23
Approved revision: 912
Merged at revision: 912
Proposed branch: lp:~allenap/maas/alt-fix-for-maas_lp1040047
Merge into: lp:maas/trunk
Diff against target: 23 lines (+6/-6)
1 file modified
src/provisioningserver/omshell.py (+6/-6)
To merge this branch: bzr merge lp:~allenap/maas/alt-fix-for-maas_lp1040047
Reviewer Review Type Date Requested Status
Andres Rodriguez 2012-08-22 Approve on 2012-08-22
Review via email: mp+120866@code.launchpad.net

Commit Message

Alternative fix for discovering dnssec-keygen.

Description of the Change

I suggested this alternative fix in https://code.launchpad.net/~andreserl/maas/maas_lp1040047/+merge/120769 but the branch was landed without it. However, roaksoax agreed it was okay, so I'm landing it here.

To post a comment you must log in.
Andres Rodriguez (andreserl) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/provisioningserver/omshell.py'
2--- src/provisioningserver/omshell.py 2012-08-22 12:32:37 +0000
3+++ src/provisioningserver/omshell.py 2012-08-22 20:44:26 +0000
4@@ -32,13 +32,13 @@
5
6
7 def call_dnssec_keygen(tmpdir):
8- dnssec_keygen = 'dnssec-keygen'
9- if os.path.exists('/usr/sbin/dnssec-keygen'):
10- dnssec_keygen = '/usr/sbin/dnssec-keygen'
11-
12+ path = os.environ.get("PATH", "").split(os.pathsep)
13+ path.append("/usr/sbin")
14+ env = dict(os.environ, PATH=os.pathsep.join(path))
15 return check_output(
16- [dnssec_keygen, '-r', '/dev/urandom', '-a', 'HMAC-MD5',
17- '-b', '512', '-n', 'HOST', '-K', tmpdir, '-q', 'omapi_key'])
18+ ['dnssec-keygen', '-r', '/dev/urandom', '-a', 'HMAC-MD5',
19+ '-b', '512', '-n', 'HOST', '-K', tmpdir, '-q', 'omapi_key'],
20+ env=env)
21
22
23 def generate_omapi_key():