Skip to content

Commit

Permalink
Native firewalld_custom_service
Browse files Browse the repository at this point in the history
* Create firewalld_custom_service type and provider
* Add spec tests
* Update Beaker tests
* Mark firewalld::custom_service for deprecation
* Resolve dependency loops

Fixes #275
  • Loading branch information
trevor-vaughan committed Mar 30, 2020
1 parent 0843da2 commit 5d7924e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 4 additions & 0 deletions lib/puppet/provider/firewalld_custom_service/firewall_cmd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def exists?

def create
debug("Adding new custom service to firewalld: #{@resource[:name]}")
@property_hash[:created] = true

require 'tempfile'

service_file = Tempfile.new(['puppet_firewalld_custom_service', '.xml'])
Expand All @@ -33,6 +35,8 @@ def create
end

def destroy
@property_hash[:destroyed] = true

delete_service
end

Expand Down
4 changes: 2 additions & 2 deletions manifests/custom_service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
'ports' => $port,
'modules' => $module,
'ipv4_destination' => $destination.dig('ipv4'),
'ipv6_destination' => $destination.dig('ipv6')
'ipv6_destination' => $destination.dig('ipv6'),
})

firewalld_custom_service { $short:
* => $_args
* => $_args,
}
}
4 changes: 0 additions & 4 deletions spec/unit/puppet/type/firewalld_custom_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
resource = described_class.new(name: 'test_test')
expect(resource[:name]).to eq('test_test')
end

it 'rejects invalid names' do
expect { described_class.new(name: 'bad name') }.to raise_error(%r{Valid values match})
end
end

context ':description validation' do
Expand Down

0 comments on commit 5d7924e

Please sign in to comment.