Class: Bosh::Agent::Platform::Centos::Network
Instance Method Summary
collapse
#dns, #setup_dhcp_from_settings, #setup_networking, #setup_networking_from_settings
Constructor Details
#initialize(template_dir) ⇒ Network
Returns a new instance of Network.
5
6
7
|
# File 'lib/bosh_agent/platform/centos/network.rb', line 5
def initialize(template_dir)
super
end
|
Instance Method Details
#restart_dhclient ⇒ Object
33
34
35
36
|
# File 'lib/bosh_agent/platform/centos/network.rb', line 33
def restart_dhclient
@logger.info("Restarting network to restart dhclient")
sh "service network restart"
end
|
#restart_networking_service ⇒ Object
18
19
20
21
|
# File 'lib/bosh_agent/platform/centos/network.rb', line 18
def restart_networking_service
@logger.info("Restarting network")
sh "service network restart"
end
|
#write_dhcp_conf ⇒ Object
23
24
25
26
27
28
29
30
31
|
# File 'lib/bosh_agent/platform/centos/network.rb', line 23
def write_dhcp_conf
template = ERB.new(load_erb("dhclient_conf.erb"), 0, '%<>-')
result = template.result(binding)
updated = Bosh::Agent::Util::update_file(result, '/etc/dhcp/dhclient.conf')
if updated
@logger.info("Updated dhclient.conf")
restart_dhclient
end
end
|
#write_network_interfaces ⇒ Object
9
10
11
12
13
14
15
16
|
# File 'lib/bosh_agent/platform/centos/network.rb', line 9
def write_network_interfaces
template = ERB.new(load_erb("centos-ifcfg.erb"), 0, '%<>-')
networks.each do |name, network|
result = template.result(binding)
Bosh::Agent::Util::update_file(result, "/etc/sysconfig/network-scripts/ifcfg-#{name}")
end
restart_networking_service
end
|