Changed from camelCase to json_case

This commit is contained in:
Ian Southam 2014-07-29 17:28:01 +02:00 committed by wilderrodrigues
parent 54b21220db
commit bcbefb2833
3 changed files with 16 additions and 10 deletions

View File

@ -1339,7 +1339,7 @@ VM_PASSWORD=""
CHEF_TMP_FILE=/tmp/cmdline.json
COMMA="\t"
echo -e "{\n\"id\": \"cmdline\"," > ${CHEF_TMP_FILE}
echo -e "{\n\"cmd_line\": {" > ${CHEF_TMP_FILE}
echo -e "{\n\"cmdline\": {" > ${CHEF_TMP_FILE}
for i in $CMDLINE
do
@ -1488,7 +1488,7 @@ done
echo -e "\n\t}\n}" >> ${CHEF_TMP_FILE}
if [ "$TYPE" != "unknown" ]
then
mv ${CHEF_TMP_FILE} /var/chef/data_bags/vr/cmd_line.json
mv ${CHEF_TMP_FILE} /var/chef/data_bags/vr/cmdline.json
fi
[ $ETH0_IP ] && LOCAL_ADDRS=$ETH0_IP

View File

@ -28,7 +28,7 @@ def load_current_resource
@current_resource.object(@new_resource.object)
@current_resource.exists = false
if new_resource.cidrs.nil?
@current_resource.cidrs(new_resource.object['publicIp'] + '/' + IPAddr.new( new_resource.object['vlanNetmask']).to_i.to_s(2).count("1").to_s)
@current_resource.cidrs(new_resource.object['public_ip'] + '/' + IPAddr.new( new_resource.object['vlan_netmask']).to_i.to_s(2).count("1").to_s)
else
@current_resource.cidrs(@new_resource.cidrs)
end
@ -66,13 +66,13 @@ def plumbDevice
end
end
if ! current_resource.contrack
if ! execute("iptables -t mangle -A PREROUTING -i #{current_resource.device} -m state --state NEW -j CONNMARK --set-mark #{current_resource.object['nicDevId']}")
if ! execute("iptables -t mangle -A PREROUTING -i #{current_resource.device} -m state --state NEW -j CONNMARK --set-mark #{current_resource.object['nic_dev_id']}")
Chef::Log.error "#{ @new_resource.device } failed to set set conmark"
return false
end
end
execute("arping -c 1 -I #{current_resource.device} -A -U -s #{current_resource.object['publicIp']} #{current_resource.object['publicIp']}")
execute("arping -c 1 -I #{current_resource.device} -A -U -s #{current_resource.object['publicIp']} #{current_resource.object['publicIp']}")
execute("arping -c 1 -I #{current_resource.device} -A -U -s #{current_resource.object['public_ip']} #{current_resource.object['public_ip']}")
execute("arping -c 1 -I #{current_resource.device} -A -U -s #{current_resource.object['public_ip']} #{current_resource.object['public_ip']}")
return true
end

View File

@ -21,6 +21,12 @@ rescue
raise format('Cannot find the %s databag item within the %s databag. Please correct this', 'vr', 'ips')
end
begin
cmdline = data_bag_item('vr', 'cmdline')
rescue
raise format('Cannot find the %s databag item within the %s databag. Please correct this', 'vr', 'ips')
end
# List configured ips on this node and remove any that are not in the configuration
listIPs(vr_ips).each do |dev, ip|
csip_device "#{dev}-#{ip}" do
@ -55,15 +61,15 @@ vr_ips.each do |name,data|
csip_route "#{name}-dev" do
type "dev"
table "Table_#{name}"
ip ipo['publicIp']
mask ipo['vlanNetmask']
ip ipo['public_ip']
mask ipo['vlan_netmask']
dev name
end
csip_route "#{name}-default" do
type "default"
table "Table_#{name}"
ip ipo['vlanGateway']
mask ipo['vlanNetmask']
ip ipo['vlan_gateway']
mask ipo['vlan_netmask']
dev name
end
end