
Optional commands can be used to specify that a command may not exist when provider suitability is determined. This is because it may be installed during the same run where it needs to be used. Previously, an empty default provider was created just to prevent failures when provider suitability was determined. This also required that the provider be explicitly overridden when the type is used. Using optional_commands instead of command reduces the amount of required code. It allows the default providers to be removed as well as the explicit provider attributes. This changed has been implemented for the following types: - nova_manage - nova_network - nova_admin
21 lines
371 B
Ruby
21 lines
371 B
Ruby
Puppet::Type.type(:nova_admin).provide(:nova_manage) do
|
|
|
|
desc "Manage nova admin user"
|
|
|
|
optional_commands :nova_manage => 'nova-manage'
|
|
|
|
def exists?
|
|
nova_manage("user", "list").match(/^#{resource[:name]}$/)
|
|
end
|
|
|
|
def create
|
|
nova_manage("user", "admin", resource[:name])
|
|
end
|
|
|
|
def destroy
|
|
nova_manage("user", "delete", resource[:name])
|
|
end
|
|
|
|
end
|
|
|