old_contents: '''
  Created on Jan 6, 2013
  
  __author__ = "Elizabeth 'pidge' Flanagan"
  __copyright__ = "Copyright 2012-2013, Intel Corp."
  __credits__ = ["Elizabeth Flanagan"]
  __license__ = "GPL"
  __version__ = "2.0"
  __maintainer__ = "Elizabeth Flanagan"
  __email__ = "elizabeth.flanagan@intel.com"
  '''
  
  
  from buildbot.steps.shell import ShellCommand
  from buildbot.process.buildstep import LogLineObserver
  from autobuilder.config import *
  
  
  class SendErrorReport(ShellCommand):
      haltOnFailure = False
      flunkOnFailure = True
      name = "SendErrorReport"
      def __init__(self, factory, argdict=None, **kwargs):
          self.factory = factory
          self.workerdir=os.path.join(os.path.join(YOCTO_ABBASE, "yocto-worker"))
          for k, v in argdict.iteritems():
              setattr(self, k, v)
          # Timeout needs to be passed to LoggingBuildStep as a kwarg
          self.timeout = 100000
          kwargs['timeout']=self.timeout
          ShellCommand.__init__(self, **kwargs)
  
      def start(self):
          self.workerdir=os.path.join(os.path.join(YOCTO_ABBASE, "yocto-worker"))
          self.buildername=self.getProperty("buildername")
          self.layerversion_core = self.getProperty("layerversion_core")
          if os.environ.get('ERROR_REPORT_DIR') is None:
              self.errordir=os.path.join(os.path.join(
                              self.workerdir, self.buildername),
                              "build/build/tmp/log/error-report/")
          else:
              self.errordir=os.environ.get('ERROR_REPORT_DIR')
          if self.layerversion_core < "4":
              self.command = "echo 'Skipping Step.'"
          else:
              if str(os.environ.get('ERROR_REPORT_COLLECT')) == "True":
                  if os.environ.get('ERROR_REPORT_SERVER') is not None:
                      self.errorreportserver = str(os.environ.get('ERROR_REPORT_SERVER'))
                  else: 
                      self.errorreportserver = ""
                  self.command = "for x in `ls " + self.errordir +"`; do if [ -d " + self.errordir +"/$x" + " ]; then send-error-report " + self.errordir +"/$x" + self.errorreportserver + "; fi; done" 
              self.description = ["Sending error reports"]
          ShellCommand.start(self)
  
  
  
new_contents: '''
  Created on Jan 6, 2013
  
  __author__ = "Elizabeth 'pidge' Flanagan"
  __copyright__ = "Copyright 2012-2013, Intel Corp."
  __credits__ = ["Elizabeth Flanagan"]
  __license__ = "GPL"
  __version__ = "2.0"
  __maintainer__ = "Elizabeth Flanagan"
  __email__ = "elizabeth.flanagan@intel.com"
  '''
  
  
  from buildbot.steps.shell import ShellCommand
  from buildbot.process.buildstep import LogLineObserver
  from autobuilder.config import *
  
  
  class SendErrorReport(ShellCommand):
      haltOnFailure = False
      flunkOnFailure = True
      name = "SendErrorReport"
      def __init__(self, factory, argdict=None, **kwargs):
          self.factory = factory
          self.workerdir=os.path.join(os.path.join(YOCTO_ABBASE, "yocto-worker"))
          for k, v in argdict.iteritems():
              setattr(self, k, v)
          # Timeout needs to be passed to LoggingBuildStep as a kwarg
          self.timeout = 100000
          kwargs['timeout']=self.timeout
          ShellCommand.__init__(self, **kwargs)
  
      def start(self):
          self.workerdir=os.path.join(os.path.join(YOCTO_ABBASE, "yocto-worker"))
          self.buildername=self.getProperty("buildername")
          self.layerversion_core = self.getProperty("layerversion_core")
          if os.environ.get('ERROR_REPORT_DIR') is None:
              self.errordir=os.path.join(os.path.join(
                              self.workerdir, self.buildername),
                              "build/build/tmp/log/error-report/")
          else:
              self.errordir=os.environ.get('ERROR_REPORT_DIR')
          if self.layerversion_core < "4":
              self.command = "echo 'Skipping Step.'"
          else:
              if str(os.environ.get('ERROR_REPORT_COLLECT')) == "True":
                  if os.environ.get('ERROR_REPORT_SERVER') is not None:
                      self.errorreportserver = str(os.environ.get('ERROR_REPORT_SERVER'))
                  else: 
                      self.errorreportserver = ""
                  self.command = "if [ -d " + self.errordir +"/$x" + " ]; then for x in `ls " + self.errordir +"`; do send-error-report " + self.errordir +"/$x" + self.errorreportserver + "; done; fi" 
              self.description = ["Sending error reports"]
          ShellCommand.start(self)
  
  
  
subject: Fix loop logic.