Skip to content

Commit 436236f

Browse files
committed
Fixing proxy_args to use both http and https
1 parent 2600983 commit 436236f

File tree

1 file changed

+84
-61
lines changed

1 file changed

+84
-61
lines changed

cloudformation/cfncluster.cfn.json

Lines changed: 84 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
"Parameters" : {
55
"KeyName" : {
66
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances",
7-
"Type" : "String",
8-
"MinLength" : "1",
9-
"MaxLength" : "64",
10-
"AllowedPattern" : "[-+_.@ a-zA-Z0-9]+",
11-
"ConstraintDescription" : "can contain only alphanumeric characters, spaces, dashes, plusses, underscores, dots, and at signs."
7+
"Type" : "AWS::EC2::KeyPair::KeyName"
128
},
139
"MasterInstanceType" : {
1410
"Description" : "Master Server EC2 instance type",
@@ -164,7 +160,7 @@
164160
},
165161
"VPCId" : {
166162
"Description" : "ID of the VPC you want to provision cluster into. Only used with UseVPCBase=false",
167-
"Type" : "String"
163+
"Type" : "AWS::EC2::VPC::Id"
168164
},
169165
"SSHFrom" : {
170166
"Description" : "Lockdown SSH access (default can be accessed from anywhere)",
@@ -321,6 +317,14 @@
321317
"torque",
322318
"test"
323319
]
320+
},
321+
"SharedDir" : {
322+
"Description" : "The path/mountpoint for the shared drive",
323+
"Type" : "String",
324+
"Default" : "/shared"
325+
},
326+
"CLITemplate" : {
327+
"Type" : "String"
324328
}
325329
},
326330
"Conditions" : {
@@ -1051,13 +1055,10 @@
10511055
},
10521056
"Condition" : "UseS3ReadWritePolicy"
10531057
},
1054-
"MasterIPAddress" : {
1058+
"MasterEIP" : {
10551059
"Type" : "AWS::EC2::EIP",
10561060
"Properties" : {
1057-
"Domain" : "vpc",
1058-
"InstanceId" : {
1059-
"Ref" : "MasterServer"
1060-
}
1061+
"Domain" : "vpc"
10611062
},
10621063
"Condition" : "MasterPublicIp"
10631064
},
@@ -1108,11 +1109,15 @@
11081109
"#!/bin/bash\n\n",
11091110
"function error_exit\n",
11101111
"{\n",
1111-
" cfn-signal ${proxy_args} -e 1 -r \"$1\" '",
1112+
" cfn-signal ${proxy_args} --exit-code=1 --reason=\"$1\" --stack=",
11121113
{
1113-
"Ref" : "MasterServerWaitHandle"
1114+
"Ref" : "AWS::StackName"
1115+
},
1116+
" --resource=MasterServer --region=",
1117+
{
1118+
"Ref" : "AWS::Region"
11141119
},
1115-
"'\n",
1120+
"\n",
11161121
" exit 1\n",
11171122
"}\n",
11181123
"proxy=",
@@ -1121,7 +1126,10 @@
11211126
},
11221127
"\n",
11231128
"if [ \"$proxy\" != \"NONE\" ]; then\n",
1124-
" proxy_args=\"--http-proxy=${proxy}\"\n",
1129+
" proxy_args=\"--http-proxy=${proxy} --https-proxy=${proxy}\"\n",
1130+
" proxy_host=$(echo \"$proxy\" | awk -F/ '{print $3}' | cut -d: -f1)\n",
1131+
" proxy_port=$(echo \"$proxy\" | awk -F/ '{print $3}' | cut -d: -f2)\n",
1132+
" echo -e \"[Boto]\nproxy = ${proxy_host}\nproxy_port = ${proxy_port}\n\" >/etc/boto.cfg\n",
11251133
"else\n",
11261134
" proxy_args=\"\"\n",
11271135
"fi\n",
@@ -1153,11 +1161,15 @@
11531161
},
11541162
" -c /tmp/cwlogs/cfn-logs.conf || error_exit 'Failed to run CloudWatch Logs agent setup'\n",
11551163
"fi\n",
1156-
"cfn-signal ${proxy_args} -e 0 -r \"MasterServer setup complete\" '",
1164+
"cfn-signal ${proxy_args} --exit-code=0 --reason=\"MasterServer setup complete\" --stack=",
1165+
{
1166+
"Ref" : "AWS::StackName"
1167+
},
1168+
" --resource=MasterServer --region=",
11571169
{
1158-
"Ref" : "MasterServerWaitHandle"
1170+
"Ref" : "AWS::Region"
11591171
},
1160-
"'\n",
1172+
"\n",
11611173
"# End of file\n"
11621174
]
11631175
]
@@ -1346,7 +1358,7 @@
13461358
"owner" : "root",
13471359
"group" : "root"
13481360
},
1349-
"/opt/cfncluster/sqswatcher/sqswatcher.cfg" : {
1361+
"/etc/sqswatcher.cfg" : {
13501362
"content" : {
13511363
"Fn::Join" : [
13521364
"",
@@ -1393,14 +1405,13 @@
13931405
"owner" : "root",
13941406
"group" : "root"
13951407
},
1396-
"/opt/cfncluster/cfncluster_supervisord.conf" : {
1408+
"/etc/cfncluster/cfncluster_supervisord.conf" : {
13971409
"content" : {
13981410
"Fn::Join" : [
13991411
"",
14001412
[
14011413
"[program:sqswatcher]\n",
1402-
"directory = /opt/cfncluster/sqswatcher\n",
1403-
"command = python ./sqswatcher.py\n"
1414+
"command = /usr/bin/sqswatcher\n"
14041415
]
14051416
]
14061417
},
@@ -1418,20 +1429,14 @@
14181429
}
14191430
}
14201431
}
1432+
},
1433+
"CreationPolicy" : {
1434+
"ResourceSignal" : {
1435+
"Count" : "1",
1436+
"Timeout" : "PT30M"
1437+
}
14211438
}
14221439
},
1423-
"MasterServerWaitCondition" : {
1424-
"Type" : "AWS::CloudFormation::WaitCondition",
1425-
"Properties" : {
1426-
"Handle" : {
1427-
"Ref" : "MasterServerWaitHandle"
1428-
},
1429-
"Timeout" : "1800"
1430-
}
1431-
},
1432-
"MasterServerWaitHandle" : {
1433-
"Type" : "AWS::CloudFormation::WaitConditionHandle"
1434-
},
14351440
"ComputeFleet" : {
14361441
"Type" : "AWS::AutoScaling::AutoScalingGroup",
14371442
"Properties" : {
@@ -1506,7 +1511,15 @@
15061511
]
15071512
}
15081513
},
1509-
"DependsOn" : "MasterServerWaitCondition"
1514+
"DependsOn" : "MasterServer",
1515+
"CreationPolicy" : {
1516+
"ResourceSignal" : {
1517+
"Timeout" : "PT30M",
1518+
"Count" : {
1519+
"Ref" : "ComputeWaitConditionCount"
1520+
}
1521+
}
1522+
}
15101523
},
15111524
"ComputeServerLaunchConfig" : {
15121525
"Type" : "AWS::AutoScaling::LaunchConfiguration",
@@ -1555,11 +1568,15 @@
15551568
"#!/bin/bash\n",
15561569
"function error_exit\n",
15571570
"{\n",
1558-
" cfn-signal ${proxy_args} -e 1 -r \"$1\" '",
1571+
" cfn-signal ${proxy_args} --exit-code=1 --reason=\"$1\" --stack=",
15591572
{
1560-
"Ref" : "ComputeWaitHandle"
1573+
"Ref" : "AWS::StackName"
15611574
},
1562-
"'\n",
1575+
" --resource=ComputeFleet --region=",
1576+
{
1577+
"Ref" : "AWS::Region"
1578+
},
1579+
"\n",
15631580
" exit 1\n",
15641581
"}\n",
15651582
"proxy=",
@@ -1568,7 +1585,10 @@
15681585
},
15691586
"\n",
15701587
"if [ \"$proxy\" != \"NONE\" ]; then\n",
1571-
" proxy_args=\"--http-proxy=${proxy}\"\n",
1588+
" proxy_args=\"--http-proxy=${proxy} --https-proxy=${proxy}\"\n",
1589+
" proxy_host=$(echo \"$proxy\" | awk -F/ '{print $3}' | cut -d: -f1)\n",
1590+
" proxy_port=$(echo \"$proxy\" | awk -F/ '{print $3}' | cut -d: -f2)\n",
1591+
" echo -e \"[Boto]\nproxy = ${proxy_host}\nproxy_port = ${proxy_port}\n\" >/etc/boto.cfg\n",
15721592
"else\n",
15731593
" proxy_args=\"\"\n",
15741594
"fi\n",
@@ -1601,11 +1621,15 @@
16011621
},
16021622
" -c /tmp/cwlogs/cfn-logs.conf || error_exit 'Failed to run CloudWatch Logs agent setup'\n",
16031623
"fi\n",
1604-
"cfn-signal ${proxy_args} -e 0 -r \"Compute setup complete\" '",
1624+
"cfn-signal ${proxy_args} --exit-code=0 --reason=\"Compute setup complete\" --stack=",
16051625
{
1606-
"Ref" : "ComputeWaitHandle"
1626+
"Ref" : "AWS::StackName"
16071627
},
1608-
"'\n"
1628+
" --resource=ComputeFleet --region=",
1629+
{
1630+
"Ref" : "AWS::Region"
1631+
},
1632+
"\n"
16091633
]
16101634
]
16111635
}
@@ -1733,7 +1757,7 @@
17331757
"owner" : "root",
17341758
"group" : "root"
17351759
},
1736-
"/opt/cfncluster/nodewatcher/nodewatcher.cfg" : {
1760+
"/etc/nodewatcher.cfg" : {
17371761
"content" : {
17381762
"Fn::Join" : [
17391763
"",
@@ -1756,14 +1780,13 @@
17561780
"owner" : "root",
17571781
"group" : "root"
17581782
},
1759-
"/opt/cfncluster/cfncluster_supervisord.conf" : {
1783+
"/etc/cfncluster/cfncluster_supervisord.conf" : {
17601784
"content" : {
17611785
"Fn::Join" : [
17621786
"",
17631787
[
17641788
"[program:nodewatcher]\n",
1765-
"directory = /opt/cfncluster/nodewatcher\n",
1766-
"command = python ./nodewatcher.py\n"
1789+
"command = /usr/bin/nodewatcher\n"
17671790
]
17681791
]
17691792
},
@@ -1830,21 +1853,6 @@
18301853
}
18311854
}
18321855
},
1833-
"ComputeWaitHandle" : {
1834-
"Type" : "AWS::CloudFormation::WaitConditionHandle"
1835-
},
1836-
"ComputeWaitCondition" : {
1837-
"Type" : "AWS::CloudFormation::WaitCondition",
1838-
"Properties" : {
1839-
"Handle" : {
1840-
"Ref" : "ComputeWaitHandle"
1841-
},
1842-
"Timeout" : "900",
1843-
"Count" : {
1844-
"Ref" : "ComputeWaitConditionCount"
1845-
}
1846-
}
1847-
},
18481856
"ScaleUpPolicy2" : {
18491857
"Type" : "AWS::AutoScaling::ScalingPolicy",
18501858
"Properties" : {
@@ -2152,6 +2160,21 @@
21522160
"RetentionInDays" : 7
21532161
},
21542162
"Condition" : "CloudWatchLogs"
2163+
},
2164+
"AssosiateEIP" : {
2165+
"Type" : "AWS::EC2::EIPAssociation",
2166+
"Properties" : {
2167+
"AllocationId" : {
2168+
"Fn::GetAtt" : [
2169+
"MasterEIP",
2170+
"AllocationId"
2171+
]
2172+
},
2173+
"NetworkInterfaceId" : {
2174+
"Ref" : "MasterENI"
2175+
}
2176+
},
2177+
"Condition" : "MasterPublicIp"
21552178
}
21562179
},
21572180
"Outputs" : {

0 commit comments

Comments
 (0)