aboutsummaryrefslogtreecommitdiffstats
path: root/lib/puppet/type
diff options
context:
space:
mode:
authorFeng Pan <fpan@redhat.com>2017-02-19 15:14:40 -0500
committerFeng Pan <fpan@redhat.com>2017-02-20 10:53:29 -0500
commitac2d7693e02a11d80879ccd80dc33a4f213295e6 (patch)
treeba4d6cb546b1db34af796b065be9b625c676cc31 /lib/puppet/type
parent32ce2b41b1ca0b6224b45d8bf79039db5e15e997 (diff)
Add support for inline config changes
This patch changes VPP configuration from file template to inline change directly. This prevents issue with overwriting existing VPP config. Change-Id: I4133be8ebe689d9288e3a8e64cca43afd7e42e64 Signed-off-by: Feng Pan <fpan@redhat.com>
Diffstat (limited to 'lib/puppet/type')
-rw-r--r--lib/puppet/type/vpp_config.rb14
-rw-r--r--lib/puppet/type/vpp_service.rb46
2 files changed, 14 insertions, 46 deletions
diff --git a/lib/puppet/type/vpp_config.rb b/lib/puppet/type/vpp_config.rb
new file mode 100644
index 0000000..17c910f
--- /dev/null
+++ b/lib/puppet/type/vpp_config.rb
@@ -0,0 +1,14 @@
+Puppet::Type.newtype(:vpp_config) do
+
+ ensurable
+
+ newparam(:setting, :namevar => true) do
+ end
+
+ newproperty(:value) do
+ munge do |value|
+ value.strip if value.is_a? String
+ end
+ end
+
+end
diff --git a/lib/puppet/type/vpp_service.rb b/lib/puppet/type/vpp_service.rb
deleted file mode 100644
index c1c818f..0000000
--- a/lib/puppet/type/vpp_service.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-Puppet::Type.newtype(:vpp_service) do
-
- ensurable
-
- newparam(:name) do
- end
-
- newparam(:pci_devs, :array_matching => :all) do
- desc "PCI dev addresses to be bound to VPP"
- def insync?(is)
- is.sort == should.sort
- end
-
- validate do |values|
- values = [values] unless values.is_a?(Array)
- values.map! do |value|
- if value =~ /\p{XDigit}+:(\p{XDigit}+):(\p{XDigit}+)\.(\p{XDigit}+)/
- value
- else
- raise(Puppet::Error, "Incorrect PCI dev address #{value}")
- end
- end
- end
-
- munge do |values|
- if values.is_a?(Array)
- values
- else
- [values]
- end
- end
- end
-
- newproperty(:state) do
- desc "VPP interface state"
- defaultto :up
- newvalues(:up, :down)
- end
-
- newparam(:copy_kernel_nic_ip) do
- desc "Whether to configure VPP interface with kernel NIC's IP settings"
- defaultto :true
- newvalues(:true, :false)
- end
-
-end