#NEWLINE# def server_cert_present( name , public_key , private_key , cert_chain = None , path = None , region = None , key = None , keyid = None , profile = None ) : #NEWLINE# #INDENT# '\n    Crete server certificate.\n\n    .. versionadded:: 2015.8.0\n\n    name (string)\n        The name for the server certificate. Do not include the path in this value.\n\n    public_key (string)\n        The contents of the public key certificate in PEM-encoded format.\n\n    private_key (string)\n        The contents of the private key in PEM-encoded format.\n\n    cert_chain (string)\n        The contents of the certificate chain. This is typically a\n        concatenation of the PEM-encoded public key certificates of the chain.\n\n    path (string)\n        The path for the server certificate.\n\n    region (string)\n        The name of the region to connect to.\n\n    key (string)\n        The key to be used in order to connect\n\n    keyid (string)\n        The keyid to be used in order to connect\n\n    profile (string)\n        The profile that contains a dict of region, key, keyid\n    ' #NEWLINE# ret = { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# 'result' : True , #NEWLINE# 'comment' : '' , #NEWLINE# 'changes' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# exists = __salt__ [ 'boto_iam.get_server_certificate' ] ( name , region , key , keyid , profile ) #NEWLINE# log . debug ( 'Variables are : {0}.' . format ( locals ( ) ) ) #NEWLINE# if exists : #NEWLINE# #INDENT# ret [ 'comment' ] = 'Certificate {0} exists.' . format ( name ) #NEWLINE# return ret #NEWLINE# #UNINDENT# if ( 'salt://' in public_key ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# public_key = __salt__ [ 'cp.get_file_str' ] ( public_key ) #NEWLINE# #UNINDENT# except IOError as e : #NEWLINE# #INDENT# log . debug ( e ) #NEWLINE# ret [ 'comment' ] = 'File {0} not found.' . format ( public_key ) #NEWLINE# ret [ 'result' ] = False #NEWLINE# return ret #NEWLINE# #UNINDENT# #UNINDENT# if ( 'salt://' in private_key ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# private_key = __salt__ [ 'cp.get_file_str' ] ( private_key ) #NEWLINE# #UNINDENT# except IOError as e : #NEWLINE# #INDENT# log . debug ( e ) #NEWLINE# ret [ 'comment' ] = 'File {0} not found.' . format ( private_key ) #NEWLINE# ret [ 'result' ] = False #NEWLINE# return ret #NEWLINE# #UNINDENT# #UNINDENT# if ( ( cert_chain is not None ) and ( 'salt://' in cert_chain ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# cert_chain = __salt__ [ 'cp.get_file_str' ] ( cert_chain ) #NEWLINE# #UNINDENT# except IOError as e : #NEWLINE# #INDENT# log . debug ( e ) #NEWLINE# ret [ 'comment' ] = 'File {0} not found.' . format ( cert_chain ) #NEWLINE# ret [ 'result' ] = False #NEWLINE# return ret #NEWLINE# #UNINDENT# #UNINDENT# if __opts__ [ 'test' ] : #NEWLINE# #INDENT# ret [ 'comment' ] = 'Server certificate {0} is set to be created.' . format ( name ) #NEWLINE# ret [ 'result' ] = None #NEWLINE# return ret #NEWLINE# #UNINDENT# created = __salt__ [ 'boto_iam.upload_server_cert' ] ( name , public_key , private_key , cert_chain , path , region , key , keyid , profile ) #NEWLINE# if ( created is not False ) : #NEWLINE# #INDENT# ret [ 'comment' ] = 'Certificate {0} was created.' . format ( name ) #NEWLINE# ret [ 'changes' ] = created #NEWLINE# return ret #NEWLINE# #UNINDENT# ret [ 'result' ] = False #NEWLINE# ret [ 'comment' ] = 'Certificate {0} failed to be created.' . format ( name ) #NEWLINE# return ret