diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2018-01-24 10:41:14 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-24 10:41:14 -0800 |
commit | 54ee60a3e9d162aedd28af7396975dc7fbaef662 (patch) | |
tree | 561be2d23f3ee9f74031ad05b4f26dca82244bc0 /roles/lib_utils | |
parent | 9a2bf772cc5a54bb3461ee1947f2885c69e95239 (diff) | |
parent | cd381ae7f8716a1dccce78d08f5776ec94cd31b7 (diff) | |
download | openshift-54ee60a3e9d162aedd28af7396975dc7fbaef662.tar.gz openshift-54ee60a3e9d162aedd28af7396975dc7fbaef662.tar.bz2 openshift-54ee60a3e9d162aedd28af7396975dc7fbaef662.tar.xz openshift-54ee60a3e9d162aedd28af7396975dc7fbaef662.zip |
Merge pull request #6603 from joelddiaz/fetch_subnet_az
Automatic merge from submit-queue.
un-hardcode default subnet az
allow defining 'default_az' for one of the subnets in the vpc structure, and pull that default_az and set it to openshift_aws_subnet_az.
this should allow one less variable to be defined/overridded when using non-default (us-east-1) regions
Diffstat (limited to 'roles/lib_utils')
-rw-r--r-- | roles/lib_utils/filter_plugins/openshift_aws_filters.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/roles/lib_utils/filter_plugins/openshift_aws_filters.py b/roles/lib_utils/filter_plugins/openshift_aws_filters.py index dfcb11da3..f16048056 100644 --- a/roles/lib_utils/filter_plugins/openshift_aws_filters.py +++ b/roles/lib_utils/filter_plugins/openshift_aws_filters.py @@ -67,8 +67,24 @@ class FilterModule(object): return tags + @staticmethod + def get_default_az(subnets): + ''' From a list of subnets/AZs in a specific region (from the VPC + structure), return the AZ that has the key/value + 'default_az=True.' ''' + + for subnet in subnets: + if subnet.get('default_az'): + return subnet['az'] + + # if there was none marked with default_az=True, just return the first + # one. (this does mean we could possible return an item that has + # default_az=False set + return subnets[0]['az'] + def filters(self): ''' returns a mapping of filters to methods ''' return {'build_instance_tags': self.build_instance_tags, + 'get_default_az': self.get_default_az, 'scale_groups_match_capacity': self.scale_groups_match_capacity, 'scale_groups_serial': self.scale_groups_serial} |