#NEWLINE# def load( imagepath ) : #NEWLINE# #INDENT# "\n    Load the specified file at imagepath into docker that was generated from\n    a docker save command\n    e.g. `docker load < imagepath`\n\n    imagepath\n        imagepath to docker tar file\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' docker.load /path/to/image\n    " #NEWLINE# status = base_status . copy ( ) #NEWLINE# if os . path . isfile ( imagepath ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# dockercmd = [ 'docker' , 'load' , '-i' , imagepath ] #NEWLINE# ret = __salt__ [ 'cmd.run' ] ( dockercmd , python_shell = False ) #NEWLINE# if ( isinstance ( ret , dict ) and ( 'retcode' in ret ) and ( ret [ 'retcode' ] != 0 ) ) : #NEWLINE# #INDENT# return _invalid ( status , id_ = None , out = imagepath , comment = 'Command to load image {0} failed.' . format ( imagepath ) ) #NEWLINE# #UNINDENT# _valid ( status , id_ = None , out = ret , comment = 'Image load success' ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# _invalid ( status , id_ = None , comment = 'Image not loaded.' , out = traceback . format_exc ( ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# _invalid ( status , id_ = None , comment = 'Image file {0} could not be found.' . format ( imagepath ) , out = traceback . format_exc ( ) ) #NEWLINE# #UNINDENT# return status