Skip to content
This repository was archived by the owner on Jan 19, 2022. It is now read-only.

Commit b8506b2

Browse files
author
Richard Pijnenburg
committed
Merge pull request #26 from bmjen/fix-windows-support
fixes windows support
2 parents b4a770b + 2eef0cb commit b8506b2

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ example:
3939
file_concat { '/tmp/file':
4040
tag => 'unique_tag', # Mandatory
4141
path => '/tmp/file', # Optional. If given it overrides the resource name.
42-
owner => 'root', # Optional. Defaults to root.
43-
group => 'root', # Optional. Defaults to root.
44-
mode => '0644' # Optional. Defaults to 0644.
42+
owner => 'root', # Optional. Defaults to undef.
43+
group => 'root', # Optional. Defaults to undef.
44+
mode => '0644' # Optional. Defaults to undef.
4545
order => 'numeric' # Optional. Set to 'numeric' or 'alpha'. Defaults to numeric.
4646
replace => true # Optional. Boolean Value. Defaults to true.
4747
backup => false # Optional. true, false, 'puppet', or a string. Defaults to 'puppet' for Filebucketing.

lib/puppet/type/file_concat.rb

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
file_concat { '/tmp/file:
1414
tag => 'unique_tag', # Mandatory
1515
path => '/tmp/file', # Optional. If given it overrides the resource name
16-
owner => 'root', # Optional. Default to root
17-
group => 'root', # Optional. Default to root
18-
mode => '0644' # Optional. Default to 0644
16+
owner => 'root', # Optional. Default to undef
17+
group => 'root', # Optional. Default to undef
18+
mode => '0644' # Optional. Default to undef
1919
order => 'numeric' # Optional, Default to 'numeric'
2020
}
2121
"
@@ -46,17 +46,14 @@ def exists?
4646

4747
newparam(:owner, :parent => Puppet::Type::File::Owner) do
4848
desc "Desired file owner."
49-
defaultto 'root'
5049
end
5150

5251
newparam(:group, :parent => Puppet::Type::File::Group) do
5352
desc "Desired file group."
54-
defaultto 'root'
5553
end
5654

5755
newparam(:mode, :parent => Puppet::Type::File::Mode) do
5856
desc "Desired file mode."
59-
defaultto '0644'
6057
end
6158

6259
newparam(:order) do
@@ -141,15 +138,17 @@ def fragment_content(r)
141138
end
142139

143140
def eval_generate
144-
[Puppet::Type.type(:file).new({
145-
:ensure => self[:ensure] == :absent ? :absent : :file,
146-
:path => self[:path],
147-
:owner => self[:owner],
148-
:group => self[:group],
149-
:mode => self[:mode],
150-
:replace => self[:replace],
151-
:backup => self[:backup],
141+
file_opts = {
142+
:ensure => self[:ensure] == :absent ? :absent : :file,
152143
:content => self.should_content,
153-
})]
144+
}
145+
146+
[:path, :owner, :group, :mode, :replace, :backup].each do |param|
147+
unless self[param].nil?
148+
file_opts[param] = self[param]
149+
end
150+
end
151+
152+
[Puppet::Type.type(:file).new(file_opts)]
154153
end
155154
end

0 commit comments

Comments
 (0)