Skip to content

Commit

Permalink
Install debug packages with debug flag
Browse files Browse the repository at this point in the history
Also adds tests

Signed-off-by: Amelia Aronsohn <squirrel@wearing.black>
  • Loading branch information
onlyhavecans committed Oct 26, 2021
1 parent 8253384 commit b0cd2a0
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 10 deletions.
5 changes: 2 additions & 3 deletions resources/authoritative_install_debian.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
version new_resource.version
end

apt_package 'pdns-server-dbg' do
apt_package 'pdns-server-dbgsym' do
action :upgrade if new_resource.allow_upgrade
only_if { new_resource.debug }
end
Expand All @@ -72,8 +72,7 @@
version new_resource.version
end

apt_package 'pdns-server-dbg' do
apt_package 'pdns-server-dbgsym' do
action :remove
only_if { new_resource.debug }
end
end
13 changes: 12 additions & 1 deletion resources/authoritative_install_rhel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
priority '90'
includepkgs 'pdns*'
action :create
not_if { new_resource.debug }
only_if { new_resource.debug }
end

if new_resource.backends
Expand All @@ -64,11 +64,22 @@
version new_resource.version
action :upgrade if new_resource.allow_upgrade
end

package 'pdns-debuginfo' do
version new_resource.version
action :upgrade if new_resource.allow_upgrade
only_if { new_resource.debug }
end
end

action :uninstall do
package 'pdns' do
action :remove
version new_resource.version
end

package 'pdns-debuginfo' do
action :remove
version new_resource.version
end
end
5 changes: 2 additions & 3 deletions resources/recursor_install_debian.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
version new_resource.version
end

apt_package 'pdns-recursor-dbg' do
apt_package 'pdns-recursor-dbgsym' do
action :upgrade if new_resource.allow_upgrade
only_if { new_resource.debug }
end
Expand All @@ -61,8 +61,7 @@
action :remove
end

apt_package 'pdns-recursor-dbg' do
apt_package 'pdns-recursor-dbgsym' do
action :remove
only_if { new_resource.debug }
end
end
12 changes: 11 additions & 1 deletion resources/recursor_install_rhel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,27 @@
priority '90'
includepkgs 'pdns*'
action :create
not_if { new_resource.debug }
only_if { new_resource.debug }
end

package 'pdns-recursor' do
version new_resource.version
action :upgrade if new_resource.allow_upgrade
end

package 'pdns-recursor-debuginfo' do
version new_resource.version
action :upgrade if new_resource.allow_upgrade
only_if { new_resource.debug }
end
end

action :uninstall do
package 'pdns-recursor' do
action :remove
end

package 'pdns-recursor-debuginfo' do
action :remove
end
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
include_recipe 'pdns_test::disable_systemd_resolved'

pdns_authoritative_install 'default'
pdns_authoritative_install 'default' do
debug true
end

pdns_authoritative_config 'default'

Expand Down
4 changes: 3 additions & 1 deletion test/cookbooks/pdns_test/recipes/recursor_install_multi.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
pdns_recursor_install 'default'
pdns_recursor_install 'default' do
debug true
end

pdns_recursor_config 'default'

Expand Down
4 changes: 4 additions & 0 deletions test/integration/authoritative-multi/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
it { should be_installed }
end

describe package(default_authoritative_debug_package) do
it { should be_installed }
end

describe port(53) do
it { should be_listening }
its('processes') { should match([/pdns_server/]) }
Expand Down
4 changes: 4 additions & 0 deletions test/integration/recursor-multi/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
it { should be_installed }
end

describe package(default_recursor_debug_package) do
it { should be_installed }
end

describe port(53) do
it { should be_listening }
its('processes') { should include 'pdns_recursor' }
Expand Down
18 changes: 18 additions & 0 deletions test/libraries/helpers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
def default_recursor_debug_package
case os[:family]
when 'debian'
'pdns-recursor-dbgsym'
when 'redhat'
'pdns-recursor-debuginfo'
end
end

def default_recursor_run_user
case os[:family]
when 'debian'
Expand Down Expand Up @@ -34,6 +43,15 @@ def default_authoritative_package
end
end

def default_authoritative_debug_package
case os[:family]
when 'debian'
'pdns-server-dbgsym'
when 'redhat'
'pdns-debuginfo'
end
end

def default_authoritative_postgres_backend_package
case os[:family]
when 'debian'
Expand Down

0 comments on commit b0cd2a0

Please sign in to comment.