Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.

Commit db8b25b

Browse files
committed
Split up config from extra
1 parent b03dc81 commit db8b25b

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

lib/puppet/provider/repository/git.rb

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def create
2020
command = [
2121
command(:git),
2222
"clone",
23+
friendly_config,
2324
friendly_extra,
2425
friendly_source,
2526
friendly_path
@@ -46,7 +47,7 @@ def command_opts
4647

4748
def build_command_opts
4849
default_command_opts.tap do |h|
49-
if uid = (self[:user] || self.class.default_user)
50+
if uid = (@resource[:user] || self.class.default_user)
5051
h[:uid] = uid
5152
end
5253
end
@@ -59,14 +60,20 @@ def default_command_opts
5960
}
6061
end
6162

62-
def friendly_extra
63-
@friendly_extra ||= [@resource[:extra]].flatten.map do |o|
64-
Shellwords.escape(o)
63+
def friendly_config
64+
@friendly_config ||= Array.new.tap do |a|
65+
@resource[:config].each do |setting, value|
66+
a << "-c #{setting}=#{value}"
67+
end
6568
end.join(' ').strip
6669
end
6770

71+
def friendly_extra
72+
@friendly_extra ||= [@resource[:extra]].flatten.join(' ').strip
73+
end
74+
6875
def friendly_source
69-
@friendly_source ||= Shellwords.escape(expand_source(@resource[:source]))
76+
@friendly_source ||= expand_source(@resource[:source])
7077
end
7178

7279
def friendly_path

lib/puppet/type/repository.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@
4747
end
4848
end
4949

50+
newparam :config do
51+
desc "The config to pass to the running provider"
52+
53+
validate do |value|
54+
unless value.is_a? Hash
55+
raise Puppet::Error, "Repository#config must be a Hash"
56+
end
57+
end
58+
end
59+
5060
newparam :extra, :array_matching => :all do
5161
desc "Extra actions or information for a provider"
5262
end

0 commit comments

Comments
 (0)