'''
Created on Dec 26, 2012

__author__ = "Elizabeth 'pidge' Flanagan"
__copyright__ = "Copyright 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 twisted.python import log

class CreateCurrentLink(ShellCommand):
    haltOnFailure = False 
    flunkOnFailure = True 
    name = "CreateCurrentLink" 
    def __init__(self, factory, argdict=None, **kwargs):
        for k, v in argdict.iteritems():
            setattr(self, k, v)
        self.description = "Creating Current Link"
        # Timeout needs to be passed to LoggingBuildStep as a kwarg
        for k, v in argdict.iteritems():
            setattr(self, k, v)
        self.timeout = 100000
        self.workdir="build/build/tmp/deploy/"
        kwargs['timeout']=self.timeout
        ShellCommand.__init__(self, **kwargs)

    def start(self):
        import os
        if str(os.environ.get('PUBLISH_BUILDS')) == "True":
            DEST=self.getProperty('DEST')
            self.command = "rm -rf " + DEST + "/../CURRENT; ln -s "+ DEST + " " + DEST+"/../CURRENT"
        else:
            self.command = "echo 'PUBLISH_BUILDS is set to False'"
        ShellCommand.start(self)

    def describe(self, done=False):
        description = ShellCommand.describe(self,done)
        return description



'''
Created on Dec 26, 2012

__author__ = "Elizabeth 'pidge' Flanagan"
__copyright__ = "Copyright 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 twisted.python import log

class CreateCurrentLink(ShellCommand):
    haltOnFailure = False 
    flunkOnFailure = True 
    name = "CreateCurrentLink" 
    def __init__(self, factory, argdict=None, **kwargs):
        for k, v in argdict.iteritems():
            setattr(self, k, v)
        self.description = "Creating Current Link"
        # Timeout needs to be passed to LoggingBuildStep as a kwarg
        for k, v in argdict.iteritems():
            setattr(self, k, v)
        self.timeout = 100000
        self.workdir="build/build/tmp/deploy/"
        kwargs['timeout']=self.timeout
        kwargs['workdir']=self.workdir
        ShellCommand.__init__(self, **kwargs)

    def start(self):
        import os
        if str(os.environ.get('PUBLISH_BUILDS')) == "True":
            DEST=self.getProperty('DEST')
            self.command = "rm -rf " + DEST + "/../CURRENT; ln -s "+ DEST + " " + DEST+"/../CURRENT"
        else:
            self.command = "echo 'PUBLISH_BUILDS is set to False'"
        ShellCommand.start(self)

    def describe(self, done=False):
        description = ShellCommand.describe(self,done)
        return description



Add workdir to kwargs