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

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