Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use instance debug instead of Puppet.debug #1052

Merged
merged 1 commit into from
May 23, 2022
Merged
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
10 changes: 5 additions & 5 deletions lib/puppet/provider/foreman_hostgroup/rest_v3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def exists?
end

def create
Puppet.debug("Creating Foreman Hostgroup #{resource[:name]} with parent #{resource[:parent_hostgroup]}")
debug("Creating Foreman Hostgroup #{resource[:name]} with parent #{resource[:parent_hostgroup]}")

if resource[:parent_hostgroup] && parent_hostgroup_id.nil?
raise Puppet::Error,
Expand Down Expand Up @@ -44,7 +44,7 @@ def create
end

def destroy
Puppet.debug("Destroying Foreman Hostgroup #{resource[:name]} with parent #{resource[:parent_hostgroup]}")
debug("Destroying Foreman Hostgroup #{resource[:name]} with parent #{resource[:parent_hostgroup]}")
path = "api/v2/hostgroups/#{id}"
r = request(:delete, path)

Expand All @@ -59,7 +59,7 @@ def destroy
def flush
return if @property_flush.empty?

Puppet.debug "Calling API to update properties for #{resource[:name]}"
debug "Calling API to update properties for #{resource[:name]}"

path = "api/v2/hostgroups/#{id}"
r = request(:put, path, {}, { hostgroup: @property_flush }.to_json)
Expand Down Expand Up @@ -107,7 +107,7 @@ def hostgroup
else
search_name
end
Puppet.debug("Searching for hostgroup with name #{search_name} and title #{search_title}")
debug("Searching for hostgroup with name #{search_name} and title #{search_title}")
r = request(:get, path, search: %(title="#{search_title}" and name="#{search_name}"))

raise Puppet::Error, "Error making GET request to Foreman at #{request_uri(path)}: #{error_message(r)}" unless success?(r)
Expand Down Expand Up @@ -141,7 +141,7 @@ def parent_hostgroup
path = 'api/v2/hostgroups'
search_title = resource[:parent_hostgroup]
search_name = resource[:parent_hostgroup_name] || search_title.split('/').last
Puppet.debug("Searching for parent hostgroup with name #{search_name} and title #{search_title}")
debug("Searching for parent hostgroup with name #{search_name} and title #{search_title}")
r = request(:get, path, search: %(title="#{search_title}" and name="#{search_name}"))

raise Puppet::Error, "Error making GET request to Foreman at #{request_uri(path)}: #{error_message(r)}" unless success?(r)
Expand Down