Skip to content

Commit

Permalink
Merge pull request #49 from jhoblitt/redhat_provider_file_mode
Browse files Browse the repository at this point in the history
ensure that network_config redhat provider flushed files have a consiste...
  • Loading branch information
adrienthebo committed Aug 3, 2013
2 parents dea5d0b + a5d1fee commit 2bb6cda
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/puppet/provider/network_config/redhat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,4 +219,8 @@ def self.unmunge(props)

pairs
end

def self.post_flush_hook(filename)
File.chmod(0644, filename)
end
end
10 changes: 10 additions & 0 deletions spec/unit/provider/network_config/redhat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -330,4 +330,14 @@ def fixture_data(file)
it { data.should match /BONDING_OPTS="mode=4 miimon=100 xmit_hash_policy=layer3\+4"/ }
end
end

describe 'when flushing a dirty file' do
it {
File.expects(:chmod).with(0644, '/not/a/real/file')
File.expects(:unlink).never
described_class.stubs(:perform_write)
described_class.dirty_file!('/not/a/real/file')
described_class.flush_file('/not/a/real/file')
}
end
end

0 comments on commit 2bb6cda

Please sign in to comment.