11from __future__ import print_function
22from __future__ import division
33from __future__ import absolute_import
4- from stacker . session_cache import get_session
4+
55import re
66import operator
77
@@ -22,31 +22,31 @@ def __init__(self, search_string):
2222
2323class AmiLookup (LookupHandler ):
2424 @classmethod
25- def handle (cls , value , provider , ** kwargs ):
25+ def handle (cls , value , context , provider ):
2626 """Fetch the most recent AMI Id using a filter
27-
27+
2828 For example:
29-
29+
3030 ${ami [<region>@]owners:self,account,amazon name_regex:serverX-[0-9]+ architecture:x64,i386}
31-
31+
3232 The above fetches the most recent AMI where owner is self
3333 account or amazon and the ami name matches the regex described,
3434 the architecture will be either x64 or i386
35-
35+
3636 You can also optionally specify the region in which to perform the
3737 AMI lookup.
38-
38+
3939 Valid arguments:
40-
40+
4141 owners (comma delimited) REQUIRED ONCE:
4242 aws_account_id | amazon | self
43-
43+
4444 name_regex (a regex) REQUIRED ONCE:
4545 e.g. my-ubuntu-server-[0-9]+
46-
46+
4747 executable_users (comma delimited) OPTIONAL ONCE:
4848 aws_account_id | amazon | self
49-
49+
5050 Any other arguments specified are sent as filters to the aws api
5151 For example, "architecture:x86_64" will add a filter
5252 """ # noqa
@@ -57,7 +57,7 @@ def handle(cls, value, provider, **kwargs):
5757 else :
5858 region = provider .region
5959
60- ec2 = get_session (region ).client ('ec2' )
60+ ec2 = provider . get_session (region = region ).client ('ec2' )
6161
6262 values = {}
6363 describe_args = {}
0 commit comments