Skip to content

Commit

Permalink
Merge pull request #9 from plazukin/master
Browse files Browse the repository at this point in the history
adding up/down scripts for interfaces
  • Loading branch information
odivlad authored Oct 3, 2024
2 parents b215e32 + 1e1ffc7 commit 8fd2ce7
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/cumulus/ifupdown2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@ def update_speed
@confighash['config']['link-duplex'] = 'full'
end

def update_up
return if @resource[:up].nil?
@confighash['config']['up'] = @resource[:up]
end

def update_down
return if @resource[:down].nil?
@confighash['config']['down'] = @resource[:down]
end

# updates vrr config in config hash
def update_vrr
return if @resource[:virtual_ip].nil?
Expand Down
2 changes: 2 additions & 0 deletions lib/puppet/provider/cumulus_interface/cumulus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def build_desired_config
end
config.update_alias_name
config.update_vrr
config.update_up
config.update_down
# attributes with no suffix like bond-, or bridge-
%w(mstpctl_portnetwork mstpctl_bpduguard mstpctl_portadminedge clagd_enable clagd_priority
clagd_backup_ip clagd_args clagd_sys_mac clagd_peer_ip clagd_vxlan_anycast_ip
Expand Down
14 changes: 14 additions & 0 deletions lib/puppet/type/cumulus_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,20 @@ def retrieve
Supply `auto` to Cumulus Linux auto-assign table id.'
end

newparam(:up) do
desc 'Up scripts or commands'
munge do |value|
@resource.munge_array(value)
end
end

newparam(:down) do
desc 'Down scripts or commands'
munge do |value|
@resource.munge_array(value)
end
end

validate do
myset = [self[:clagd_enable].nil?, self[:clagd_peer_ip].nil?,
self[:clagd_sys_mac].nil?].to_set
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "c2devel-cumulus_interfaces",
"version": "1.2.10",
"version": "1.2.11",
"author": "Cumulus Networks",
"summary": "Configures Cumulus Linux interfaces",
"license": "GPLv2",
Expand Down

0 comments on commit 8fd2ce7

Please sign in to comment.