Skip to content

Commit

Permalink
First attempt to fix hound errors
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewoliver committed Dec 10, 2018
1 parent 718a948 commit add2a61
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 26 deletions.
2 changes: 1 addition & 1 deletion chef/cookbooks/dhcp/providers/host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
end
new_resource.updated_by_last_action(true)
end
for host_list in ["host_list.conf", "host6_list.conf"] do
["host_list.conf", "host6_list.conf"].each do |host_list|
utils_line "include \"#{filename}\";" do
action :remove
file "/etc/dhcp3/hosts.d/#{host_list}"
Expand Down
2 changes: 1 addition & 1 deletion chef/cookbooks/dhcp/providers/subnet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
end
new_resource.updated_by_last_action(true)
end
for subnet_list in ["subnet_list.conf", "subnet6_list.conf"] do
["subnet_list.conf", "subnet6_list.conf"].each do |subnet_list|
utils_line "include \"#{filename}\";" do
action :remove
file "/etc/dhcp3/subnets.d/#{subnet_list}"
Expand Down
6 changes: 3 additions & 3 deletions chef/cookbooks/provisioner/recipes/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,10 @@
crowbar_node = node_search_with_cache("roles:crowbar").first
address = crowbar_node["crowbar"]["network"]["admin"]["address"]
protocol = crowbar_node["crowbar"]["apache"]["ssl"] ? "https" : "http"
if IPAddr.new(address).ipv6?
server = "#{protocol}://[#{address}]"
server = if IPAddr.new(address).ipv6?
"#{protocol}://[#{address}]"
else
server = "#{protocol}://#{address}"
"#{protocol}://#{address}"
end
password = crowbar_node["crowbar"]["users"]["crowbar"]["password"]
verify_ssl = !crowbar_node["crowbar"]["apache"]["insecure"]
Expand Down
41 changes: 23 additions & 18 deletions chef/cookbooks/provisioner/recipes/dhcp_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@

admin_net = Barclamp::Inventory.get_network_definition(node, "admin")
lease_time = node[:provisioner][:dhcp]["lease-time"]
admin6_uri = "tftp://[#{admin_ip}]/discovery"

ipv4_dhcp_opts = ["allow unknown-clients",
"default-lease-time #{lease_time}",
"max-lease-time #{lease_time}",
'if exists dhcp-parameter-request-list {
ipv4_dhcp_opts = [
"allow unknown-clients",
"default-lease-time #{lease_time}",
"max-lease-time #{lease_time}",
'if exists dhcp-parameter-request-list {
# Always send the PXELINUX options (specified in hexadecimal)
option dhcp-parameter-request-list = concat(option dhcp-parameter-request-list,d0,d1,d2,d3);
}',
'if option arch = 00:06 {
'if option arch = 00:06 {
filename = "discovery/ia32/efi/bootia32.efi";
} else if option arch = 00:07 {
filename = "discovery/x86_64/efi/default/boot/bootx64.efi";
Expand All @@ -30,28 +32,31 @@
} else {
filename = "discovery/x86_64/bios/pxelinux.0";
}',
"next-server #{admin_ip}"]
"next-server #{admin_ip}"
]

ipv6_dhcp_opts = ["allow unknown-clients",
"default-lease-time #{lease_time}",
"max-lease-time #{lease_time}",
'if exists dhcp-parameter-request-list {
ipv6_dhcp_opts = [
"allow unknown-clients",
"default-lease-time #{lease_time}",
"max-lease-time #{lease_time}",
'if exists dhcp-parameter-request-list {
# Always send the PXELINUX options (specified in hexadecimal)
option dhcp-parameter-request-list = concat(option dhcp-parameter-request-list,d0,d1,d2,d3);
}',
"if option dhcp6.client-arch-type = 00:06 {
option dhcp6.bootfile-url \"tftp://[#{admin_ip}]/discovery/ia32/efi/bootia32.efi\";
"if option dhcp6.client-arch-type = 00:06 {
option dhcp6.bootfile-url \"#{admin6_uri}/ia32/efi/bootia32.efi\";
} else if option dhcp6.client-arch-type = 00:07 {
option dhcp6.bootfile-url \"tftp://[#{admin_ip}]/discovery/x86_64/efi/default/boot/bootx64.efi\";
option dhcp6.bootfile-url \"/#{admin6_uri}x86_64/efi/default/boot/bootx64.efi\";
} else if option dhcp6.client-arch-type = 00:09 {
option dhcp6.bootfile-url \"tftp://[#{admin_ip}]/discovery/x86_64/efi/default/boot/bootx64.efi\";
option dhcp6.bootfile-url \"#{admin6_uri}/x86_64/efi/default/boot/bootx64.efi\";
} else if option dhcp6.client-arch-type = 00:0b {
option dhcp6.bootfile-url \"tftp://[#{admin_ip}]/discovery/aarch64/efi/default/boot/bootaa64.efi\";
option dhcp6.bootfile-url \"#{admin6_uri}/aarch64/efi/default/boot/bootaa64.efi\";
} else if option dhcp6.client-arch-type = 00:0e {
option dhcp6.bootfile-url \"tftp://[#{admin_ip}]/discovery/discovery/ppc64le/bios/\";
option dhcp6.bootfile-url \"#{admin6_uri}/discovery/ppc64le/bios/\";
} else {
option dhcp6.bootfile-url \"tftp://[#{admin_ip}]/discovery/x86_64/bios/pxelinux.0\";
}"]
option dhcp6.bootfile-url \"#{admin6_uri}/x86_64/bios/pxelinux.0\";
}"
]

pool_opts = {
"host" => ["deny unknown-clients"]
Expand Down
6 changes: 3 additions & 3 deletions chef/cookbooks/provisioner/recipes/setup_base_images.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
admin_ip = IPAddr.new(admin_net.address)
domain_name = node[:dns].nil? ? node[:domain] : (node[:dns][:domain] || node[:domain])
web_port = node[:provisioner][:web_port]
provisioner_web="http://#{admin_ip.to_s}:#{web_port}" if admin_ip.ipv4?
provisioner_web="http://[#{admin_ip.to_s}]:#{web_port}" if admin_ip.ipv6?
provisioner_web="http://#{admin_ip}:#{web_port}" if admin_ip.ipv4?
provisioner_web="http://[#{admin_ip}]:#{web_port}" if admin_ip.ipv6?
append_line = node[:provisioner][:discovery][:append].dup # We'll modify it inline

crowbar_node = node_search_with_cache("roles:crowbar").first
Expand Down Expand Up @@ -301,7 +301,7 @@
notifies :reload, resources(service: "xinetd")
end
else
ip_addr = admin_ip.ipv6? ? "[#{admin_ip.to_s}]" : admin_ip.to_s
ip_addr = admin_ip.ipv6? ? "[#{admin_ip}]" : admin_ip.to_s
template "/etc/systemd/system/tftp.service" do
source "tftp.service.erb"
owner "root"
Expand Down

0 comments on commit add2a61

Please sign in to comment.