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

update pdk #76

Merged
merged 4 commits into from
Mar 15, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pdkignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
/.fixtures.yml
/Gemfile
/.gitattributes
/.github/
/.gitignore
/.pdkignore
/.puppet-lint.rc
Expand Down
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ group :development do
gem "rubocop", '= 1.48.1', require: false
gem "rubocop-performance", '= 1.16.0', require: false
gem "rubocop-rspec", '= 2.19.0', require: false
gem "puppet-strings", '~> 4.0', require: false
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-blacksmith", require: false
gem "github_changelog_generator", require: false
Expand All @@ -43,6 +44,10 @@ group :system_tests do
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
gem "serverspec", '~> 2.41', require: false
end
group :release_prep do
gem "puppet-strings", '~> 4.0', require: false
gem "puppetlabs_spec_helper", '~> 6.0', require: false
end

puppet_version = ENV['PUPPET_GEM_VERSION']
facter_version = ENV['FACTER_GEM_VERSION']
Expand Down
11 changes: 10 additions & 1 deletion lib/puppet/provider/libvirt_network/virsh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,16 @@ def content
formatter = REXML::Formatters::Pretty.new(2)
formatter.compact = true
output = ''.dup
formatter.write(recursive_sort(xml.root), output)

xml = recursive_sort(xml.root)
sorted_portgroups = xml.root.get_elements('//portgroup').sort_by { |obj| obj.attributes['name'] }

REXML::XPath.match(xml, '//portgroup').each(&:remove)
sorted_portgroups.each do |pg|
xml.root.add_element pg
end

formatter.write(xml.root, output)
output
end

Expand Down
16 changes: 16 additions & 0 deletions lib/puppet/type/libvirt_network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@
raise ArgumentError, 'content needs to be a XML string' unless value.is_a?(String)
end

def change_to_s(current, desire)
if @resource[:show_diff]
current_exp = Tempfile.new('current', '/tmp').open
current_exp.write(current.to_s)
current_exp.close
current_path = current_exp.path
desire_exp = Tempfile.new('desire', '/tmp').open
desire_exp.write(desire.to_s)
desire_exp.close
desire_path = desire_exp.path
system "diff -u #{current_path} #{desire_path}"
else
'{md5}' + Digest::MD5.hexdigest(current.to_s) + ' to: ' + '{md5}' + Digest::MD5.hexdigest(desire.to_s)
end
end

def should_to_s(value)
if @resource[:show_diff]
":\n" + value + "\n"
Expand Down
6 changes: 3 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"drbd",
"virtualization"
],
"pdk-version": "3.0.0",
"template-url": "pdk-default#3.0.0",
"template-ref": "tags/3.0.0-0-g056e50d"
"pdk-version": "3.0.1",
"template-url": "pdk-default#3.0.1",
"template-ref": "tags/3.0.1-0-gd13288a"
}
7 changes: 4 additions & 3 deletions spec/default_facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
#
# Facts specified here will override the values provided by rspec-puppet-facts.
---
ipaddress: "172.16.254.254"
ipaddress6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA"
networking:
ip: "172.16.254.254"
ip6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA"
mac: "AA:AA:AA:AA:AA:AA"
is_pe: false
macaddress: "AA:AA:AA:AA:AA:AA"
Loading