#NEWLINE# def config_( dev = None , **kwargs ) : #NEWLINE# #INDENT# "\n    Show or update config of a bcache device.\n\n    If no device is given, operate on the cache set itself.\n\n    CLI example:\n\n    .. code-block:: bash\n\n        salt '*' bcache.config\n        salt '*' bcache.config bcache1\n        salt '*' bcache.config errors=panic journal_delay_ms=150\n        salt '*' bcache.config bcache1 cache_mode=writeback writeback_percent=15\n\n    :return: config or True/False\n    " #NEWLINE# if ( dev is None ) : #NEWLINE# #INDENT# spath = _fspath ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# spath = _bcpath ( dev ) #NEWLINE# #UNINDENT# updates = dict ( [ ( key , val ) for ( key , val ) in kwargs . items ( ) if ( not key . startswith ( '__' ) ) ] ) #NEWLINE# if dev : #NEWLINE# #INDENT# endres = 0 #NEWLINE# for ( key , val ) in updates . items ( ) : #NEWLINE# #INDENT# endres += _sysfs_attr ( [ spath , key ] , val , 'warn' , 'Failed to update {0} with {1}' . format ( os . path . join ( spath , key ) , val ) ) #NEWLINE# #UNINDENT# return ( endres > 0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# data = _sysfs_parse ( spath , config = True , internals = True , options = True ) #NEWLINE# for key in ( 'other_ro' , 'inter_ro' ) : #NEWLINE# #INDENT# if ( key in data ) : #NEWLINE# #INDENT# del data [ key ] #NEWLINE# #UNINDENT# #UNINDENT# for key in data . keys ( ) : #NEWLINE# #INDENT# result . update ( data [ key ] ) #NEWLINE# #UNINDENT# return result