Autocorrect PDK validation warnings

This commit is contained in:
2019-05-09 23:41:09 +01:00
parent 998f1716f3
commit 939f795d37
26 changed files with 537 additions and 584 deletions

View File

@@ -1,7 +1,7 @@
Puppet::Type.type(:entropy_repo).provide(:file) do
desc "File provider for Entropy Repositories"
defaultfor :operatingsystem => :sabayon
desc 'File provider for Entropy Repositories'
defaultfor operatingsystem: :sabayon
mk_resource_methods
@@ -18,57 +18,55 @@ Puppet::Type.type(:entropy_repo).provide(:file) do
disabled_filename = "/etc/entropy/repositories.conf.d/_entropy_#{type_prefix}#{@property_hash[:name]}"
if value == 'true' || value == :true
if File.exists?(disabled_filename)
if File.exist?(disabled_filename)
File.rename(disabled_filename, enabled_filename)
end
else
if File.exists?(enabled_filename)
if File.exist?(enabled_filename)
File.rename(enabled_filename, disabled_filename)
end
end
@property_hash[:enabled] = value
end
def self.instances
repos = Dir.entries('/etc/entropy/repositories.conf.d/')
repos.collect do |r|
repos.map { |r|
if r == '.' || r == '..'
nil
elsif r =~ /\.example$/
elsif r =~ %r{\.example$}
nil
elsif r !~ /^_?entropy_/
elsif r !~ %r{^_?entropy_}
nil
else
matches = /^(_)?entropy_(enman_)?(.*)$/.match(r)
matches = %r{^(_)?entropy_(enman_)?(.*)$}.match(r)
enabled = matches[1].nil? ? 'true' : 'false'
type = matches[2] == 'enman_' ? 'enman' : 'entropy'
type = (matches[2] == 'enman_') ? 'enman' : 'entropy'
name = matches[3]
repo = {
:name => name,
:repo_type => type,
:enabled => enabled,
:provider => :entropy_repo,
name: name,
repo_type: type,
enabled: enabled,
provider: :entropy_repo,
}
new(repo)
end
end.compact
}.compact
end
def self.prefetch(resources)
repos = self.instances()
repos = instances
resources.each do |name, resource|
resources.each do |name, _resource|
if provider = repos.find { |r| r.name == name }
resources[name].provider = provider
end
end
end
end
# vim: set ts=2 shiftwidth=2 expandtab :