Skip to content

Commit

Permalink
Merge pull request #193 from yuichiro-naito/fix_resource_for_freebsd
Browse files Browse the repository at this point in the history
Fix to use specinfra to avoid calling direct command.
  • Loading branch information
ryotarai committed Mar 6, 2016
2 parents cadd381 + 7194cc2 commit b5f4150
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/itamae/resource/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,17 @@ def action_edit(options)
if attributes.mode
run_specinfra(:change_file_mode, @temppath, attributes.mode)
else
run_command(['chmod', '--reference', attributes.path, @temppath])
mode = run_specinfra(:get_file_mode, attributes.path).stdout.chomp
run_specinfra(:change_file_mode, @temppath, mode)
end

if attributes.owner || attributes.group
run_specinfra(:change_file_owner, @temppath, attributes.owner, attributes.group)
else
run_command(['chown', '--reference', attributes.path, @temppath])
owner = run_specinfra(:get_file_owner_user, attributes.path).stdout.chomp
group = run_specinfra(:get_file_owner_group, attributes.path).stdout.chomp
run_specinfra(:change_file_owner, @temppath, owner)
run_specinfra(:change_file_group, @temppath, group)
end

unless check_command(["diff", "-q", @temppath, attributes.path])
Expand Down

0 comments on commit b5f4150

Please sign in to comment.