#NEWLINE# def get_container_root( container ) : #NEWLINE# #INDENT# "\n    Get the container rootfs path\n\n    container\n        container id or grain\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' docker.get_container_root <container id>\n    " #NEWLINE# default_path = os . path . join ( '/var/lib/docker' , 'containers' , _get_container_infos ( container ) [ 'Id' ] ) #NEWLINE# default_rootfs = os . path . join ( default_path , 'rootfs' ) #NEWLINE# rootfs_re = re . compile ( '^lxc.rootfs\\s*=\\s*(.*)\\s*$' , re . U ) #NEWLINE# try : #NEWLINE# #INDENT# lxcconfig = os . path . join ( default_path , 'config.lxc' ) #NEWLINE# with salt . utils . fopen ( lxcconfig ) as fhr : #NEWLINE# #INDENT# lines = fhr . readlines ( ) #NEWLINE# rlines = lines [ : ] #NEWLINE# rlines . reverse ( ) #NEWLINE# for rline in rlines : #NEWLINE# #INDENT# robj = rootfs_re . search ( rline ) #NEWLINE# if robj : #NEWLINE# #INDENT# rootfs = robj . groups ( ) [ 0 ] #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# except Exception : #NEWLINE# #INDENT# rootfs = default_rootfs #NEWLINE# #UNINDENT# return rootfs