5
5
import re
6
6
from datetime import datetime
7
7
8
- import boto
9
- from boto import sqs
8
+ import pytz
9
+ from boto import sqs , UserAgent
10
+ from boto .sqs import connection as _sqs_connection # can't reference connection from sqs module
10
11
from boto .ec2 import EC2Connection , elb , get_region
11
12
from boto .ec2 .elb import ELBConnection
12
- from boto .sqs import connection
13
- import boto3
13
+ from boto .exception import BotoServerError
14
14
from botocore .config import Config
15
15
from botocore .exceptions import ClientError
16
- import pytz
16
+ from boto3 import (
17
+ resource as boto3resource ,
18
+ client as boto3client
19
+ )
17
20
18
21
from wrapanapi .entities import (Instance , Stack , StackMixin , Template ,
19
22
TemplateMixin , VmMixin , VmState )
@@ -253,7 +256,7 @@ def refresh(self):
253
256
"""
254
257
try :
255
258
self .raw = self ._api .describe_stacks (StackName = self ._uuid )['Stacks' ][0 ]
256
- except boto . exception . BotoServerError as error :
259
+ except BotoServerError as error :
257
260
if error .status == 404 :
258
261
raise NotFoundError ('stack {}' .format (self ._uuid ))
259
262
else :
@@ -385,7 +388,7 @@ def __init__(self, **kwargs):
385
388
self ._region = get_region (self ._region_name )
386
389
self .api = EC2Connection (self ._username , self ._password , region = self ._region )
387
390
388
- self .sqs_connection = connection .SQSConnection (
391
+ self .sqs_connection = _sqs_connection .SQSConnection (
389
392
self ._username , self ._password , region = _regions (
390
393
regionmodule = sqs , regionname = self ._region_name )
391
394
)
@@ -395,23 +398,23 @@ def __init__(self, **kwargs):
395
398
regionmodule = elb , regionname = self ._region_name )
396
399
)
397
400
398
- self .s3_connection = boto3 . resource (
401
+ self .s3_connection = boto3resource (
399
402
's3' , aws_access_key_id = self ._username , aws_secret_access_key = self ._password ,
400
403
region_name = self ._region_name , config = connection_config
401
404
)
402
405
403
- self .ec2_connection = boto3 . client (
406
+ self .ec2_connection = boto3client (
404
407
'ec2' , aws_access_key_id = self ._username , aws_secret_access_key = self ._password ,
405
408
region_name = self ._region_name , config = connection_config
406
409
)
407
410
408
- self .cloudformation_connection = boto3 . client (
411
+ self .cloudformation_connection = boto3client (
409
412
'cloudformation' , aws_access_key_id = self ._username ,
410
413
aws_secret_access_key = self ._password , region_name = self ._region_name ,
411
414
config = connection_config
412
415
)
413
416
414
- self .sns_connection = boto3 . client ('sns' , region_name = self ._region_name )
417
+ self .sns_connection = boto3client ('sns' , region_name = self ._region_name )
415
418
416
419
self .kwargs = kwargs
417
420
@@ -438,7 +441,7 @@ def disconnect(self):
438
441
439
442
def info (self ):
440
443
"""Returns the current versions of boto and the EC2 API being used"""
441
- return '%s %s' % (boto . UserAgent , self .api .APIVersion )
444
+ return '%s %s' % (UserAgent , self .api .APIVersion )
442
445
443
446
def _get_instances (self , ** kwargs ):
444
447
"""
0 commit comments