Skip to content

Commit bfd78a1

Browse files
committed
more
1 parent 3af3f18 commit bfd78a1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/puppet/provider/package/openbsd.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def self.instances
3939
# now turn each returned line into a package object
4040
process.each_line { |line|
4141
match = regex.match(line.split[0])
42-
if match
42+
next unless match
4343
fields.zip(match.captures) { |field, value|
4444
hash[field] = value
4545
}
@@ -144,7 +144,7 @@ def get_full_name(latest = false)
144144
end
145145
"#{resource[:name]}-#{use_version}-#{resource[:flavor]}"
146146
elsif resource[:name].to_s.match(/[a-z0-9]%[0-9a-z]/i)
147-
"#{resource[:name]}"
147+
resource[:name].to_s
148148
elsif !latest
149149
"#{resource[:name]}--"
150150
else
@@ -158,9 +158,9 @@ def get_full_name(latest = false)
158158
end
159159

160160
if resource[:flavor]
161-
[ @resource[:name], use_version, @resource[:flavor]].join('-').gsub(/-+$/, '')
161+
[@resource[:name], use_version, @resource[:flavor]].join('-').gsub(/-+$/, '')
162162
else
163-
[ @resource[:name], use_version ]
163+
[@resource[:name], use_version]
164164
end
165165
end
166166
end
@@ -180,7 +180,7 @@ def get_version
180180
# pkg_info -I might return multiple lines, i.e. flavors
181181
matching_pkgs = pkginfo("-I", "pkg_search_name")
182182
matching_pkgs.each_line do |line|
183-
if match = regex.match(line.split[0])
183+
next unless (match = regex.match(line.split[0]))
184184
# now we return the first version, unless ensure is latest
185185
version = match.captures[1]
186186
return version unless @resource[:ensure] == "latest"
@@ -192,8 +192,9 @@ def get_version
192192
return master_version unless master_version == 0
193193

194194
return '' if version == -1
195+
195196
raise Puppet::Error, _("%{version} is not available for this package") % { version: version }
196-
197+
197198
rescue Puppet::ExecutionFailure
198199
nil
199200
end

0 commit comments

Comments
 (0)