#NEWLINE# def service_present( name , service_type , description = None , profile = None , **connection_args ) : #NEWLINE# #INDENT# '\n    Ensure service present in Keystone catalog\n\n    name\n        The name of the service\n\n    service_type\n        The type of Openstack Service\n\n    description (optional)\n        Description of the service\n    ' #NEWLINE# ret = { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# 'changes' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# 'result' : True , #NEWLINE# 'comment' : 'Service "{0}" already exists' . format ( name ) , #NEWLINE# #UNINDENT# } #NEWLINE# role = __salt__ [ 'keystone.service_get' ] ( name = name , profile = profile , ** connection_args ) #NEWLINE# if ( 'Error' not in role ) : #NEWLINE# #INDENT# return ret #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if __opts__ [ 'test' ] : #NEWLINE# #INDENT# ret [ 'result' ] = None #NEWLINE# ret [ 'comment' ] = 'Service "{0}" will be added' . format ( name ) #NEWLINE# ret [ 'changes' ] [ 'Service' ] = 'Will be created' #NEWLINE# return ret #NEWLINE# #UNINDENT# __salt__ [ 'keystone.service_create' ] ( name , service_type , description , profile = profile , ** connection_args ) #NEWLINE# ret [ 'comment' ] = 'Service "{0}" has been added' . format ( name ) #NEWLINE# ret [ 'changes' ] [ 'Service' ] = 'Created' #NEWLINE# #UNINDENT# return ret