Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/puppet-swagger-generator/files/swagger/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def self.prefetch(resources)
end

def exists?
Puppet.info("Checking if #{name} exists")
Puppet.debug("Checking if #{resource.type}[#{name}] exists")
@property_hash[:ensure] and @property_hash[:ensure] != :absent
end

Expand Down
8 changes: 6 additions & 2 deletions lib/puppet-swagger-generator/templates/type.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Puppet::Type.newtype(:<%= namespace %>_<%= name %>) do
validate do
required_properties = [
<% model['required'].each do |property| %>
<%= property.swagger_to_snake_case.to_sym %>,
:<%= property.swagger_to_snake_case.to_sym %>,
<% end %>
]
required_properties.each do |property|
Expand All @@ -33,8 +33,12 @@ Puppet::Type.newtype(:<%= namespace %>_<%= name %>) do
end
<% model['properties'].each do |property_name, details| %>
<% unless exclusions.include? property_name %>
<% if details['type'] == 'array' %>
newproperty(:<%= property_name.swagger_to_snake_case %>, :array_matching => :all) do
<% else %>
newproperty(:<%= property_name.swagger_to_snake_case %>) do
<% if model['description'] %>
<% end %>
<% if details['description'] %>
desc "<%= details['description'].gsub('"', "'") %>"
<% end %>
def insync?(is)
Expand Down