#NEWLINE# def mock_check_output( command , * args , **kwargs ) : #NEWLINE# #INDENT# if ( command [ : 2 ] == [ 'systemctl' , 'is-enabled' ] ) : #NEWLINE# #INDENT# if ( command [ 2 ] not in enabled ) : #NEWLINE# #INDENT# raise sp . CalledProcessError ( 1 , 'systemctl' , 'not found' ) #NEWLINE# #UNINDENT# return 'ok' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( command [ : 2 ] == [ 'systemctl' , 'enable' ] ) : #NEWLINE# #INDENT# configfile = path . join ( systemd_service . SYSTEM_D_INIT_DIR , command [ 2 ] ) #NEWLINE# if ( not path . exists ( configfile ) ) : #NEWLINE# #INDENT# raise sp . CalledProcessError ( 1 , 'systemctl' , 'not found' ) #NEWLINE# #UNINDENT# enabled [ command [ 2 ] ] = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( configfile [ : 2 ] == [ 'systemctl' , 'disable' ] ) : #NEWLINE# #INDENT# configfile = path . join ( systemd_service . SYSTEM_D_INIT_DIR , command [ 2 ] ) #NEWLINE# if ( not path . exists ( configfile ) ) : #NEWLINE# #INDENT# raise sp . CalledProcessError ( 1 , 'systemctl' , 'not found' ) #NEWLINE# #UNINDENT# del enabled [ command [ 2 ] ] #NEWLINE# return 'ok' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise Exception ( ( 'unknown command %r' % command ) )