Skip to content

Commit a4e8406

Browse files
Enrico Usaiddeidda
authored andcommitted
Apply network configuration for Ubuntu18 at Chef converge time
The `reload_network_config` is a helper function that defines for all OSes (but Ubuntu18) a `service` Chef resource that is executed at converge time. For Ubuntu18 it was executed at compilation time because there was no a chef resource, now by defining a `ruby_block` we're executing it a converge time like the other OSes. Signed-off-by: Enrico Usai <[email protected]>
1 parent 04fb07b commit a4e8406

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

libraries/helpers.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,11 @@ def restart_network_service
260260
#
261261
def reload_network_config
262262
if node['platform'] == 'ubuntu' && node['platform_version'].to_i == 18
263-
Mixlib::ShellOut.new("netplan apply").run_command
263+
ruby_block "apply network configuration" do
264+
block do
265+
Mixlib::ShellOut.new("netplan apply").run_command
266+
end
267+
end
264268
else
265269
restart_network_service
266270
end

recipes/network_interfaces_config.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ def cidr_to_netmask(cidr)
9595
end
9696
end
9797

98-
9998
# Apply configuration
10099
reload_network_config
101100
end

0 commit comments

Comments
 (0)