Skip to content

Commit

Permalink
Fixed librarian on linux (issues with ENV)
Browse files Browse the repository at this point in the history
  • Loading branch information
desertkun committed Jan 10, 2019
1 parent ac86de8 commit 310b45c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
11 changes: 11 additions & 0 deletions ruby/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ GEM
puppet_forge (~> 2.1)
rsync
certified (1.0.0)
facter (2.5.1)
facter (2.5.1-x86-mingw32)
ffi (~> 1.9.5)
faraday (0.13.1)
Expand All @@ -30,6 +31,15 @@ GEM
minitar (0.6.1)
multi_json (1.13.1)
multipart-post (2.0.0)
puppet (6.1.0)
facter (> 2.0.1, < 4)
fast_gettext (~> 1.1.2)
hiera (>= 3.2.1, < 4)
httpclient (~> 2.8)
locale (~> 2.1)
multi_json (~> 1.10)
puppet-resource_api (~> 1.5)
semantic_puppet (~> 1.0)
puppet (6.1.0-x86-mingw32)
facter (> 2.0.1, < 4)
fast_gettext (~> 1.1.2)
Expand Down Expand Up @@ -73,6 +83,7 @@ GEM
yard (0.9.16)

PLATFORMS
ruby
x86-mingw32

DEPENDENCIES
Expand Down
2 changes: 1 addition & 1 deletion src/async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export function execFileReadIn(command: string, cwd: string, env?: any, cb?: Exe
{
if (error != null)
{
reject(stdout);
reject(stderr);
}
else
{
Expand Down
17 changes: 14 additions & 3 deletions src/puppet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export module puppet
return null;
}

public static async CallBin(script: string, args: string[], cwd: string, env: any, cb?: async.ExecFileLineCallback): Promise<boolean>
public static async CallBin(script: string, args: string[], cwd: string, env_: any, cb?: async.ExecFileLineCallback): Promise<boolean>
{
const argsTotal = [
Ruby.Path().rubyPath,
Expand All @@ -52,8 +52,11 @@ export module puppet
argsTotal.push(arg);
}

env["SSL_CERT_FILE"] = require('app-root-path').resolve("ruby", "cacert.pem");
env["PATH"] = process.env["PATH"] + path.delimiter + Ruby.Path().path;
const env = Object.assign({}, process.env);
Object.assign(env, env_);

env["SSL_CERT_FILE"] = require('app-root-path').resolve("ruby/cacert.pem");
env["PATH"] = Ruby.Path().path + path.delimiter + process.env["PATH"];

try
{
Expand Down Expand Up @@ -856,6 +859,10 @@ export module puppet
env["LIBRARIAN_PUPPET_USE_SHORT_CACHE_PATH"] = "true";
env["LIBRARIAN_PUPPET_TMP"] = "C:/";
}
else
{
env["LIBRARIAN_PUPPET_TMP"] = path.join(this._path, ".tmp");
}

await Ruby.CallBin("librarian-puppet", ["install", "--verbose"], this._path, env, (line: string) =>
{
Expand Down Expand Up @@ -1339,6 +1346,10 @@ export module puppet
env["LIBRARIAN_PUPPET_USE_SHORT_CACHE_PATH"] = "true";
env["LIBRARIAN_PUPPET_TMP"] = "C:/";
}
else
{
env["LIBRARIAN_PUPPET_TMP"] = path.join(this._path, ".tmp");
}

await Ruby.CallBin("librarian-puppet", ["install", "--verbose"], this._path, env, (line: string) =>
{
Expand Down

0 comments on commit 310b45c

Please sign in to comment.