github.com/jlmeeker/kismatic@v1.10.1-0.20180612190640-57f9005a1f1a/ansible/filter_plugins/container_images.py (about) 1 from ansible import errors 2 3 # Returns the name of the container image that should be used 4 # depending on whether a private registry is being used. 5 def final_image(upstream_image, registry_url = '', private = False): 6 if not private: 7 return upstream_image 8 if registry_url == '': 9 raise errors.AnsibleFilterError('Must pass registry url when using private registry.') 10 return registry_url + "/" + upstream_image 11 12 class FilterModule(object): 13 filter_map = { 14 'final_image': final_image 15 } 16 17 def filters(self): 18 return self.filter_map