#NEWLINE# def _upstart_enable( name ) : #NEWLINE# #INDENT# '\n    Enable an Upstart service.\n    ' #NEWLINE# if _upstart_is_enabled ( name ) : #NEWLINE# #INDENT# return _upstart_is_enabled ( name ) #NEWLINE# #UNINDENT# override = '/etc/init/{0}.override' . format ( name ) #NEWLINE# files = [ '/etc/init/{0}.conf' . format ( name ) , override ] #NEWLINE# for file_name in itertools . ifilter ( os . path . isfile , files ) : #NEWLINE# #INDENT# with salt . utils . fopen ( file_name , 'r+' ) as fp_ : #NEWLINE# #INDENT# new_text = re . sub ( '^\\s*manual\\n?' , '' , fp_ . read ( ) , 0 , re . MULTILINE ) #NEWLINE# fp_ . seek ( 0 ) #NEWLINE# fp_ . write ( new_text ) #NEWLINE# fp_ . truncate ( ) #NEWLINE# #UNINDENT# #UNINDENT# if ( os . access ( override , os . R_OK ) and ( os . path . getsize ( override ) == 0 ) ) : #NEWLINE# #INDENT# os . unlink ( override ) #NEWLINE# #UNINDENT# return _upstart_is_enabled ( override )