-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
tphoney
committed
Aug 1, 2018
1 parent
5090e67
commit 0d96b21
Showing
3 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require_relative '../../puppet_x/puppetlabs/netdev_stdlib/check' | ||
if PuppetX::NetdevStdlib::Check.use_old_netdev_type | ||
Puppet::Type.newtype(:banner) do | ||
@doc = 'Set various banner on a device' | ||
|
||
apply_to_all | ||
|
||
newparam(:name, namevar: true) do | ||
desc 'The banner resource. The name stays as "default"' | ||
newvalues(:default) | ||
end | ||
|
||
newproperty(:motd) do | ||
desc 'The MOTD banner' | ||
munge { |v| String(v) } | ||
end | ||
end | ||
else | ||
require 'puppet/resource_api' | ||
|
||
Puppet::ResourceApi.register_type( | ||
name: 'banner', | ||
docs: 'Set various banner on a device.', | ||
features: ['remote_resource'], | ||
attributes: { | ||
name: { | ||
type: 'String', | ||
desc: 'The banner resource. The name stays as "default"', | ||
behaviour: :namevar, | ||
default: 'default', | ||
}, | ||
motd: { | ||
type: 'String', | ||
desc: 'The MOTD banner', | ||
}, | ||
} | ||
) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# encoding: utf-8 | ||
|
||
require 'spec_helper' | ||
describe 'banner' do | ||
describe 'old style' do | ||
fake_operatingsystem | ||
describe Puppet::Type.type(:banner) do | ||
it_behaves_like 'name is the namevar' | ||
end | ||
end | ||
describe 'resource-api' do | ||
describe 'the banner type' do | ||
it 'loads' do | ||
expect(Puppet::Type.type(:banner)).not_to be_nil | ||
end | ||
end | ||
end | ||
end |