Skip to content

Commit

Permalink
Make CLI also work for non os packages (e.g. jenkins user and group d…
Browse files Browse the repository at this point in the history
…oes not exist)
  • Loading branch information
elconas committed Jun 30, 2017
1 parent e42c7b1 commit fb283f2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/puppet_x/jenkins/provider/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ def self.cli(command, options = {}, cli_pre_cmd = [])
tmp.write input
tmp.flush
options[:stdinfile] = tmp.path
FileUtils.chown 'jenkins', 'jenkins', tmp.path if tmpfile_as_param and File.exists?(tmp.path)
begin
Etc.getpwnam('jenkins')
FileUtils.chown 'jenkins', 'jenkins', tmp.path if tmpfile_as_param and File.exists?(tmp.path)
rescue
FileUtils.chmod 0644, tmp.path if tmpfile_as_param and File.exists?(tmp.path)
end
result = execute_with_retry(command, options, cli_pre_cmd)
tmp.close
tmp.unlink
Expand Down

0 comments on commit fb283f2

Please sign in to comment.