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

Add Puppet 8 support #1139

Merged
merged 3 commits into from Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/puppet/functions/foreman/foreman.rb
Expand Up @@ -71,7 +71,7 @@ def foreman(item, search, per_page = "20", foreman_url = "https://localhost", fo
if use_tfmproxy
configfile = '/etc/foreman-proxy/settings.yml'
configfile = use_tfmproxy if use_tfmproxy.is_a? String
raise Puppet::ParseError, "File #{configfile} not found while use_tfmproxy is enabled" unless File.exists?(configfile)
raise Puppet::ParseError, "File #{configfile} not found while use_tfmproxy is enabled" unless File.exist?(configfile)
tfmproxy = YAML.load(File.read(configfile))
uri = URI.parse(tfmproxy[:foreman_url])
http = Net::HTTP.new(uri.host, uri.port)
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Expand Up @@ -48,7 +48,7 @@
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 7.0.0 < 8.0.0"
"version_requirement": ">= 7.0.0 < 9.0.0"
}
],
"operatingsystem_support": [
Expand Down
4 changes: 4 additions & 0 deletions spec/functions/foreman_foreman_spec.rb
Expand Up @@ -10,6 +10,10 @@
is_expected.to run.with_params().and_raise_error(ArgumentError)
end

it 'should throw an error with filter_result=true' do
is_expected.to run.with_params('hosts', 'hostgroup=Grid', '20', 'https://foreman.example.com', 'my_api_foreman_user', 'my_api_foreman_pass', 10, true).and_raise_error(Puppet::ParseError, /Foreman: Invalid filter_result/)
end

it 'should succeed with no timeout specified' do
stub_request(:get, "https://foreman.example.com/api/hosts?per_page=20&search=hostgroup=Grid").
with(basic_auth: ['my_api_foreman_user', 'my_api_foreman_pass']).
Expand Down