Skip to content

allow docker::networks::networks param to be undef #783

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

Merged
merged 1 commit into from
May 4, 2022
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
6 changes: 4 additions & 2 deletions manifests/networks.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# @param networks
#
class docker::networks (
$networks
Optional[Hash[String, Hash]] $networks = undef,
) {
create_resources(docker_network, $networks)
if $networks {
create_resources(docker_network, $networks)
}
}
6 changes: 6 additions & 0 deletions spec/classes/networks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,14 @@
'ip_range' => params['ip_range'],
)
}

it { is_expected.to have_docker_network_resource_count(1) }
end
end

context 'with no params' do
it { is_expected.to have_docker_network_resource_count(0) }
end
end
end
end