File tree Expand file tree Collapse file tree 3 files changed +34
-9
lines changed Expand file tree Collapse file tree 3 files changed +34
-9
lines changed Original file line number Diff line number Diff line change 55import urllib2
66import boto3
77import time
8+ import ConfigParser
9+ from botocore .config import Config
810
911
1012def main ():
@@ -34,8 +36,17 @@ def main():
3436 # List of available block devices after removing currently used block devices
3537 availableDevices = [a for a in blockDevices if a not in paths ]
3638
39+ # Parse configuration file to read proxy settings
40+ config = ConfigParser .RawConfigParser ()
41+ config .read ('/etc/boto.cfg' )
42+ proxy_config = Config ()
43+ if config .has_option ('Boto' , 'proxy' ) and config .has_option ('Boto' , 'proxy_port' ):
44+ proxy = config .get ('Boto' , 'proxy' )
45+ proxy_port = config .get ('Boto' , 'proxy_port' )
46+ proxy_config = Config (proxies = {'https' : "{}:{}" .format (proxy , proxy_port )})
47+
3748 # Connect to AWS using boto
38- ec2 = boto3 .client ('ec2' , region_name = region )
49+ ec2 = boto3 .client ('ec2' , region_name = region , config = proxy_config )
3950
4051 # Attach the volume
4152 dev = availableDevices [0 ].replace ('xvd' , 'sd' )
Original file line number Diff line number Diff line change 66import syslog
77import time
88import boto3
9+ import ConfigParser
10+ from botocore .config import Config
911
1012
1113def main ():
@@ -35,8 +37,17 @@ def main():
3537 region = urllib2 .urlopen ("http://169.254.169.254/latest/meta-data/placement/availability-zone" ).read ()
3638 region = region [:- 1 ]
3739
40+ # Parse configuration file to read proxy settings
41+ config = ConfigParser .RawConfigParser ()
42+ config .read ('/etc/boto.cfg' )
43+ proxy_config = Config ()
44+ if config .has_option ('Boto' , 'proxy' ) and config .has_option ('Boto' , 'proxy_port' ):
45+ proxy = config .get ('Boto' , 'proxy' )
46+ proxy_port = config .get ('Boto' , 'proxy_port' )
47+ proxy_config = Config (proxies = {'https' : "{}:{}" .format (proxy , proxy_port )})
48+
3849 # Connect to AWS using boto
39- ec2 = boto3 .client ('ec2' , region_name = region )
50+ ec2 = boto3 .client ('ec2' , region_name = region , config = proxy_config )
4051
4152 # Poll for blockdevicemapping
4253 devices = ec2 .describe_instance_attribute (InstanceId = instanceId , Attribute = 'blockDeviceMapping' ).get ('BlockDeviceMappings' )
Original file line number Diff line number Diff line change 117117# Check whether install a custom cfncluster-node package or the standard one
118118if !node [ 'cfncluster' ] [ 'custom_node_package' ] . nil? && !node [ 'cfncluster' ] [ 'custom_node_package' ] . empty?
119119 # Install custom cfncluster-node package
120- execute "install cfncluster-node" do
121- command "sudo pip uninstall --yes cfncluster-node &&" \
122- "cd /tmp &&" \
123- "curl -v -L -o /tmp/cfncluster-node.tgz #{ node [ 'cfncluster' ] [ 'custom_node_package' ] } &&" \
124- "tar -xzf /tmp/cfncluster-node.tgz &&" \
125- "cd /tmp/cfncluster-node-* &&" \
126- "sudo /usr/bin/python setup.py install"
120+ bash "install cfncluster-node" do
121+ cwd '/tmp'
122+ code <<-EOH
123+ source /tmp/proxy.sh
124+ sudo pip uninstall --yes cfncluster-node
125+ curl -v -L -o cfncluster-node.tgz #{ node [ 'cfncluster' ] [ 'custom_node_package' ] }
126+ tar -xzf cfncluster-node.tgz
127+ cd cfncluster-node-*
128+ sudo /usr/bin/python setup.py install
129+ EOH
127130 end
128131else
129132 # Install cfncluster-node package
You can’t perform that action at this time.
0 commit comments