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,54 +1,51 @@
Puppet::Type.type(:enman_repo).provide(:enman) do
desc "Enman provider for Enman Repositories"
defaultfor :operatingsystem => :sabayon
desc 'Enman provider for Enman Repositories'
commands({:enman => "enman"})
defaultfor operatingsystem: :sabayon
commands(enman: 'enman')
mk_resource_methods
def create
enman("add", resource[:name])
@property_hash[:ensure] = :present
enman('add', resource[:name])
@property_hash[:ensure] = :present
end
def destroy
enman("remove", resource[:name])
@property_hash[:ensure] = :absent
enman('remove', resource[:name])
@property_hash[:ensure] = :absent
end
def exists?
@property_hash[:ensure] == :present
end
def self.instances
all_installed = enman("list", "--quiet", "--installed").chomp.split
all_available = enman("list", "--quiet", "--available").chomp.split
all_installed = enman('list', '--quiet', '--installed').chomp.split
all_available = enman('list', '--quiet', '--available').chomp.split
all_available.collect do |available_repo|
all_available.map do |available_repo|
repo = {
:name => available_repo,
:ensure => all_installed.include?(available_repo) ? :present : :absent,
:provider => :enman_repo,
name: available_repo,
ensure: all_installed.include?(available_repo) ? :present : :absent,
provider: :enman_repo,
}
Puppet.debug(repo)
new(repo)
end
end
def self.prefetch(resources)
available_repos = self.instances()
available_repos = instances
resources.each do |name, resource|
resources.each do |name, _resource|
if provider = available_repos.find { |r| r.name == name }
resources[name].provider = provider
end
end
end
end
# vim: set ts=2 shiftwidth=2 expandtab :