def find_ci_id(self, name, type):
        sp = SearchParameters()
        sp.setType(Type.valueOf(str(type)))

        for p in XLReleaseServiceHolder.getRepositoryService().listEntities(sp):
            if str(p.getTitle()) == name:
               return p
    def __init__(self, *args, **kwargs):
        """
        TODO: need to come up with a way to resolve variables used inside the profile
                Best way to do this i think is to pull all available variables form the xlr context and match the
                dictonary's values against them
        :param args:
        :param kwargs:
        :return:
        """

        # pull in the xlrelease apis
        self.__releaseApi = XLReleaseServiceHolder.getReleaseApi()
        self.__repositoryService = XLReleaseServiceHolder.getRepositoryService(
        )
        self.__taskApi = XLReleaseServiceHolder.getTaskApi()
        self.__phaseApi = XLReleaseServiceHolder.getPhaseApi()

        self.__variable_start_regex = re.compile('\$\{', re.IGNORECASE)
        # TODO: replace with {} once testing is done

        self.__variable_start_string = "$<"
        self.__variable_end_string = ">"

        self.store = dict()

        if kwargs.has_key('url'):
            kwargs = self.load_from_url(kwargs['url'])
        elif kwargs.has_key('repoId'):
            kwargs = self.load_profile_from_xlr_repo(kwargs['repoId'])
        elif kwargs.has_key('repoString'):
            kwargs = json.loads(str(kwargs['repoString']))

        self.update(dict(*args, **kwargs))  # use the free update to set keys
    def __init__(self, *args, **kwargs):
        """
        TODO: need to come up with a way to resolve variables used inside the profile
                Best way to do this i think is to pull all available variables form the xlr context and match the
                dictonary's values against them
        :param args:
        :param kwargs:
        :return:
        """

        # pull in the xlrelease apis
        self.__releaseApi = XLReleaseServiceHolder.getReleaseApi()
        self.__repositoryService = XLReleaseServiceHolder.getRepositoryService()
        self.__taskApi = XLReleaseServiceHolder.getTaskApi()
        self.__phaseApi = XLReleaseServiceHolder.getPhaseApi()

        self.__variable_start_regex = re.compile('\$\{', re.IGNORECASE)
        # TODO: replace with {} once testing is done

        self.__variable_start_string = "$<"
        self.__variable_end_string = ">"

        self.store = dict()

        if kwargs.has_key('url'):
            kwargs = self.load_from_url(kwargs['url'])
        elif kwargs.has_key('repoId'):
            kwargs = self.load_profile_from_xlr_repo(kwargs['repoId'])
        elif kwargs.has_key('repoString'):
            kwargs = json.loads(str(kwargs['repoString']))

        self.update(dict(*args, **kwargs))  # use the free update to set keys
def find_ci_id(name, type):
    sp = SearchParameters()
    sp.setType(Type.valueOf(type))

    for p in XLReleaseServiceHolder.getRepositoryService().listEntities(sp):
        if str(p.getTitle()) == name:
           return p
def load_profile(profile):
    sp = SearchParameters()
    sp.setType(Type.valueOf('rel.ReleaseProfile'))

    for p in XLReleaseServiceHolder.getRepositoryService().listEntities(sp):
        if str(p.getTitle()) == profile:
            return json.loads(p.getProperty('profileJson'))
    def find_template_id_by_name(self, name):
        sp = SearchParameters()
        sp.setType(Type.valueOf(str('xlrelease.Release')))

        for p in XLReleaseServiceHolder.getRepositoryService().listEntities(sp):
            if p.isTemplate() == True:
                if str(p.getTitle()) == str(name):
                    Base.info("Found id: %s for name %s" % (str(p.getId()), name))
                    return str(p.getId())

        return None
    def find_template_id_by_name(self, name):
        sp = SearchParameters()
        sp.setType(Type.valueOf(str('xlrelease.Release')))

        for p in XLReleaseServiceHolder.getRepositoryService().listEntities(
                sp):
            if p.isTemplate() == True:
                if str(p.getTitle()) == str(name):
                    Base.info("Found id: %s for name %s" %
                              (str(p.getId()), name))
                    return str(p.getId())

        return None
    def __init__(self, *args, **kwargs):

         # pull in the xlrelease apis
        self.__releaseApi        = XLReleaseServiceHolder.getReleaseApi()
        self.__repositoryService = XLReleaseServiceHolder.getRepositoryService()
        self.__taskApi           = XLReleaseServiceHolder.getTaskApi()

        self.__variable_start_regex = re.compile('^\$\{', re.IGNORECASE)


        self.store = dict()



        if kwargs.has_key('url'):
            kwargs = self.load_from_url(kwargs['url'])
        elif kwargs.has_key('repoId'):
            kwargs = self.load_profile_from_xlr_repo(kwargs['repoId'])
        elif kwargs.has_key('repoString'):
            kwargs = json.loads(str(kwargs['repoString']))

        self.update(dict(*args, **kwargs))  # use the free update to set keys
Exemple #9
0
import com.xebialabs.deployit.repository.SearchParameters as SearchParameters
import com.xebialabs.deployit.plugin.api.udm.ConfigurationItem as ConfigurationItem
import com.xebialabs.xlrelease.domain.Configuration as Configuration
import com.xebialabs.deployit.plugin.api.reflect.Type as Type
import com.xebialabs.deployit.jcr
import com.xebialabs.deployit.repository
from com.xebialabs.deployit.plugin.api.reflect import DescriptorRegistry
from com.xebialabs.deployit.plugin.api.reflect import Type
import com.xebialabs.deployit.engine.api.dto.ValidatedConfigurationItem

from Base import Base

import datetime

# Globals
__repositoryService = XLReleaseServiceHolder.getRepositoryService()
__ciType = 'rel.ReleaseCounterStore'

StorageTimestamp = " "



def get_ci_object(ciType, id):
    if not DescriptorRegistry.exists(Type.valueOf(ciType)):
        raise ValueError('Unknown CI type %s' % ciType)
    type = Type.valueOf(ciType)
    configurationItem = type.descriptor.newInstance(id)
    return configurationItem

def check_ci_for_validations(ci):
    if isinstance(ci, com.xebialabs.deployit.engine.api.dto.ValidatedConfigurationItem) and not ci.validations.isEmpty():