当前位置: 首页>>代码示例>>Python>>正文


Python Base.info方法代码示例

本文整理汇总了Python中Base.Base.info方法的典型用法代码示例。如果您正苦于以下问题:Python Base.info方法的具体用法?Python Base.info怎么用?Python Base.info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Base.Base的用法示例。


在下文中一共展示了Base.info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: createSimpleTask

# 需要导入模块: from Base import Base [as 别名]
# 或者: from Base.Base import info [as 别名]
def createSimpleTask(phaseId, taskTypeValue, title, propertyMap):
    """
    adds a custom task to a phase in the release
    :param phaseId: id of the phase
    :param taskTypeValue: type of task to add
    :param title: title of the task
    :param propertyMap: properties to add to the task
    :return:
    """
    # print propertyMap

    parenttaskType = Type.valueOf("xlrelease.CustomScriptTask")

    parentTask = parenttaskType.descriptor.newInstance("nonamerequired")
    parentTask.setTitle(title)

    childTaskType = Type.valueOf(taskTypeValue)
    childTask = childTaskType.descriptor.newInstance("nonamerequired")
    for item in propertyMap:
        if childTask.hasProperty(item):
            childTask.setProperty(item, propertyMap[item])
        else:
            Base.info("dropped property: %s on %s because: not applicable" % (item, taskTypeValue))
    parentTask.setPythonScript(childTask)

    print str(parentTask)
    taskApi.addTask(str(phaseId), parentTask)
开发者ID:WianVos,项目名称:xlr-lm-artifactory-plugin,代码行数:29,代码来源:darProfile.py

示例2: load_from_url

# 需要导入模块: from Base import Base [as 别名]
# 或者: from Base.Base import info [as 别名]
    def load_from_url(self, url):
        """
        reaches out to a url and loads the profile
        :param url:
        :return: dict: profile
        """
        print type(url)
        if type(url) == list:


            # if we are fed a list of urls
            # resolve each one and merge them with the later url taking precedence
            outputDict = {}
            for u in url :
                Base.info("Attempting to fetch profile at: %s" % u)
                response = requests.get(u, verify=False)
                response.raise_for_status()
                print json.loads(str(response.text))
                outputDict = dict(self.merge_profiles(outputDict, json.loads(str(response.text))))
            pprint.pprint(outputDict)
            return outputDict

        else:
            response = requests.get(url, verify=False)
            response.raise_for_status()

            return json.loads(str(response.text))
开发者ID:WianVos,项目名称:xlr-release-profile-plugin,代码行数:29,代码来源:__init__.py

示例3: handle_profile

# 需要导入模块: from Base import Base [as 别名]
# 或者: from Base.Base import info [as 别名]
def handle_profile(profile, targetPhase):
    """
    parse the loaded profile and add a task for each item in it
    :param profile: json or dict
    :param targetPhase: phase to add the steps to
    :return:
    """

    loaded_profile = load_profile(profile)
    phaseId = get_target_phase(targetPhase)
    title_nr = 0

    for type, data in loaded_profile.items():

        if __type_step_dict.has_key(type):
            taskTypeValue = __type_step_dict[type]
        else:
            taskTypeValue = type

        for data_item in data:
            final_data_items = dict(data_item.items() + __default_data_items.items())
            title_nr += 1

            title = get_title("dar_build_task_%s_%i" % (type, title_nr), taskTypeValue, data_item)
            Base.info("creating step: %s" % title)

            createSimpleTask(phaseId, taskTypeValue, title, final_data_items)
开发者ID:WianVos,项目名称:xlr-lm-artifactory-plugin,代码行数:29,代码来源:darProfile.py

示例4: createSimpleTaskObject

# 需要导入模块: from Base import Base [as 别名]
# 或者: from Base.Base import info [as 别名]
    def createSimpleTaskObject(self, taskTypeValue, title, propertyMap={}, parentTypeValue = None ):
        """
        adds a custom task to a phase in the release
        :param phaseId: id of the phase
        :param taskTypeValue: type of task to add
        :param title: title of the task
        :param propertyMap: properties to add to the task
        :return:
        """



        if parentTypeValue == None:
            taskType = Type.valueOf(str(taskTypeValue))

            Task = taskType.descriptor.newInstance("nonamerequired")
            Task.setTitle(title)
            for item in propertyMap:

                if Task.hasProperty(item):
                    type = Task.getType()
                    desc = type.getDescriptor()
                    pd = desc.getPropertyDescriptor(item)

                    if str(pd.getKind()) == "CI":
                        Task.setProperty(item, self.find_ci_id(str(item), pd.getReferencedType()))
                    else:
                        Task.setProperty(item, propertyMap[item])

                else:
                    Base.info("dropped property: %s on %s because: not applicable" % (item, taskTypeValue))

            return Task


        else:
        # print propertyMap
            parenttaskType = Type.valueOf(str(parentTypeValue))

            parentTask = parenttaskType.descriptor.newInstance("nonamerequired")
            parentTask.setTitle(title)
            childTaskType = Type.valueOf(taskTypeValue)
            childTask = childTaskType.descriptor.newInstance("nonamerequired")
            for item in propertyMap:

                if childTask.hasProperty(item):
                    type = childTask.getType()
                    desc = type.getDescriptor()
                    pd = desc.getPropertyDescriptor(item)

                    if str(pd.getKind()) == "CI":
                        childTask.setProperty(item, self.find_ci_id(str(item), pd.getReferencedType()))
                    else:
                        childTask.setProperty(item, propertyMap[item])

                else:
                    Base.info("dropped property: %s on %s because: not applicable" % (item, taskTypeValue))
            parentTask.setPythonScript(childTask)

            return parentTask
开发者ID:WianVos,项目名称:xlr-release-profile-plugin,代码行数:62,代码来源:__init__.py

示例5: get_path

# 需要导入模块: from Base import Base [as 别名]
# 或者: from Base.Base import info [as 别名]
    def get_path(self, json, path):
        """
        traverses the dictionary derived from the json to look if it can satisfy the requested path
        :param json:
        :param path:
        :return:
        """

        if (type(path) is str) or (type(path) is unicode):
            path = str(path).split('/')

        field = path.pop(0)

        try:
            if json.has_key(field):
                if type(json[field]) == dict:
                    return self.get_path(json[field], path)

                elif type(json[field]) == list:
                    if len(json[field]) < 2:
                        Base.info("found %s" % (json[field][0]))
                        return str(json[field][0])

                elif len(path) == 0:
                    Base.info("found %s using path %s" % (field, path))
                    return str(json[field])
            else:
                Base.warning("the requested path of %s could not be found in the json document. returning None instead")
                return None
        except Exception:
            Base.error("Error encountered during resolution")
开发者ID:WianVos,项目名称:xlr-release-profile-plugin,代码行数:33,代码来源:__init__.py

示例6: resolve_xlr_template_variables_in_settings

# 需要导入模块: from Base import Base [as 别名]
# 或者: from Base.Base import info [as 别名]
    def resolve_xlr_template_variables_in_settings(self, input_object, release_id):
        '''
        resolve xlr variables in dictionaries
        :param release_id:
        :param input_dictionary:
        :return:
        '''


        output_list = []
        output_dict = {}

        # step through the dictionary
        if type(input_object) == str or type(input_object) == unicode:
            if '${' in input_object:
                 Base.info("found variable in %s" % input_object)
                 input_object = self.replace_xlr_variable_in_string(input_object, release_id)
            return input_object


        if isinstance(input_object, dict):
            for k,v in input_object.items():
                output_dict[k] = self.resolve_xlr_template_variables_in_settings(v, release_id)
            return output_dict
        if isinstance(input_object, list):
            for v in input_object:
                output_list.append(self.resolve_xlr_template_variables_in_settings(v, release_id))
            return output_list
开发者ID:WianVos,项目名称:xlr-release-profile-plugin,代码行数:30,代码来源:__init__.py

示例7: update_ci_to_repo

# 需要导入模块: from Base import Base [as 别名]
# 或者: from Base.Base import info [as 别名]
def update_ci_to_repo(storeName, data):



    Base.info("writing ci: %s to repo" % storeName)

    global StorageTimestamp
    # get the store
    store = load_ci_from_repo(storeName, __ciType)

    # set the properties on the ci to be updated
    for k, v in data.items():

        store.setProperty(k, json.dumps(v))

    store.setProperty('modTime', time_stamp())
    # write back to xlr
    if get_counter_timestamp(storeName) == StorageTimestamp:
        try:
            __repositoryService.update(store)
            return True
        except com.xebialabs.deployit.jcr.RuntimeRepositoryException as e:
            Base.error('Error detected while saving %s' % storeName)
            Base.error('Error: %s' % e)
            return False
        except com.xebialabs.deployit.repository.ItemConflictException as e:
            Base.error('Error detected while saving %s' % storeName)
            Base.error('Error: %s' % e)
            return False
    else:
        Base.error('deadlock collision detected while saving %s' % storeName)
        return False
开发者ID:xebialabs-community,项目名称:xlr-release-profile-plugin,代码行数:34,代码来源:ReleaseCounter.py

示例8: get_title

# 需要导入模块: from Base import Base [as 别名]
# 或者: from Base.Base import info [as 别名]
def get_title(title, citype, data):

    Base.info("GATHERING TITLE for %s" % citype)

    if __type_title_dict.has_key(citype):
        print __type_title_dict[citype]

        new_title = []
        for x in ["prefix", "data_fields", "postfix"]:
            try:
                out = __type_title_dict[citype][x]

                if type(out) == list:
                    for e in out:

                        try:

                            new_title.append(str(data[e]))
                        except KeyError:
                            Base.warning("unable to retrieve %s from step data" % e)
                else:
                    new_title.append(out)
            except KeyError:
                Base.warning("no data defined for field %s" % x)

        return " ".join(new_title)
    else:
        return title
开发者ID:WianVos,项目名称:xlr-lm-artifactory-plugin,代码行数:30,代码来源:darProfile.py

示例9: persist_variables_to_release

# 需要导入模块: from Base import Base [as 别名]
# 或者: from Base.Base import info [as 别名]
    def persist_variables_to_release(self, releaseId):
        """
        Handles resolving the variables and injecting them into the template
        :return:
        """
        release = self.__releaseApi.getRelease(releaseId)

        self.set_variables_from_dict(self.resolve_xlr_template_variables(releaseId))

        Base.info("resolved profile:")
        print self.variables()

        # handle variables inside the release first

        newVariables = {}

        # printing the variables for reporting
        for k, v in self.variables().items():
            Base.info("key: %s \t value: %s \n" % (k, v))

        for key, value in self.variables().items():
            if re.match(self.__variable_start_regex, key) is None:
                key = "${%s}" % (key)
                if type(value) is dict:
                    value = self.resolve_variable(**value)
                if value == None:
                    Base.fatal("a value could not be generated for %s .. we are unable to keep the release valid" % key)
                    sys.exit(2)
                newVariables[key] = value
        release.setVariableValues(newVariables)
        self.__releaseApi.updateRelease(releaseId, release)
开发者ID:WianVos,项目名称:xlr-release-profile-plugin,代码行数:33,代码来源:__init__.py

示例10: resolve_settings

# 需要导入模块: from Base import Base [as 别名]
# 或者: from Base.Base import info [as 别名]
    def resolve_settings(self, inputDict, inputSettings):
        '''
        scan the inputDict for variable markers and look for resolution in the settings section of the template
        :param inputDict: Dictionary to scan
        :param inputSettings: settings that pertain to this input dictionary
        :return: dictionary with resolution information
        '''

        vars_list = []
        resolve_dict = {}
        output_dict = {}

        if inputSettings != None:
            # find all the variables in the target dictionary
            for k, v in inputDict.items():
                if isinstance(v, unicode) or isinstance(v, str):
                    x = self.find_all_variables(str(v))
                    if x:
                        vars_list = vars_list + list(set(x) - set(vars_list))


            # loop over the list with found variables
            for v in vars_list:
                # check if we can find a resolution in the settings for this app
                if inputSettings.has_key(v):
                    # if we find a list in settings for this variable concatenate and dump
                    if type(inputSettings[v]) is list:
                        resolve_dict[v] = ",".join(inputSettings[v])
                    else:
                        resolve_dict[v] = inputSettings[v]

            # loop over the resolve_dict and check it for stuff that could trigger a more specific set of variables
            if inputSettings.has_key('specific_settings'):
                specific_dict = inputSettings['specific_settings']
                for k, v in resolve_dict.items():
                    if specific_dict.has_key(k):
                        if specific_dict[k].has_key(v):
                            resolve_dict.update(specific_dict[k][v])

            # do one last loop over the dictionaries non list/dict objects and replace the placeholders/variables with te result
            for k, v in inputDict.items():
                if isinstance(v, unicode) or isinstance(v, str):
                    # loop over the keys of the resolve dict
                    for s in resolve_dict.keys():
                        ps = self.__variable_start_string + str(s) + self.__variable_end_string

                        v = v.replace(ps, resolve_dict[s])

                output_dict[k] = v

            for k, v in output_dict.items():
                Base.info("Key: %s resolved to: %s" % (k, v))

            return output_dict
        else:
            return inputDict
开发者ID:WianVos,项目名称:xlr-release-profile-plugin,代码行数:58,代码来源:__init__.py

示例11: replace_xlr_variable_in_string

# 需要导入模块: from Base import Base [as 别名]
# 或者: from Base.Base import info [as 别名]
    def replace_xlr_variable_in_string(self, input_string, release_id):

        xlr_variables = self.get_release_variables(release_id)
        pprint.pprint(xlr_variables)
        for x, y in xlr_variables.items():
            if x in input_string and y != "":
                Base.info("replacing variable %s with value %s" % (x, y))
                input_string = input_string.replace(x, y)

        return input_string
开发者ID:WianVos,项目名称:xlr-release-profile-plugin,代码行数:12,代码来源:__init__.py

示例12: resolve_variables

# 需要导入模块: from Base import Base [as 别名]
# 或者: from Base.Base import info [as 别名]
    def resolve_variables(self):

        for key, val in self.variables():
            if type(val) == dict:
                solution = self.resolve_variable(val)
                if solution == None:
                    Base.fatal("value for %s could not be found using the specified collector" % key)
                    sys.exit(2)
                else:
                    Base.info("retrieved value: %s for %s" % (solution, key))
                self.set_variable(key, solution)
开发者ID:WianVos,项目名称:xlr-release-profile-plugin,代码行数:13,代码来源:__init__.py

示例13: find_template_id_by_name

# 需要导入模块: from Base import Base [as 别名]
# 或者: from Base.Base import info [as 别名]
    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
开发者ID:WianVos,项目名称:xlr-release-profile-plugin,代码行数:13,代码来源:__init__.py

示例14: load_profile

# 需要导入模块: from Base import Base [as 别名]
# 或者: from Base.Base import info [as 别名]
def load_profile(profile):
    """
    returns a dict .. if input is json it will return ad dict .. if dict it will return the dict
    :param profile:
    :return:
    """

    if type(profile) is dict:
        return profile
    else:
        Base.info("loading profile from json")
        return json.loads(profile.replace("\n", "").replace("\t", "").replace("\r", ""))
开发者ID:WianVos,项目名称:xlr-lm-artifactory-plugin,代码行数:14,代码来源:darProfile.py

示例15: destroy_counter_store

# 需要导入模块: from Base import Base [as 别名]
# 或者: from Base.Base import info [as 别名]
def destroy_counter_store(storeName):
    '''
    Destroys a release counter store
    :param storeName:
    :return:
    '''

    if ci_exists(storeName, __ciType):

        ci = load_ci_from_repo(storeName, __ciType )

        __repositoryService.delete(ci.getId())
        Base.info("Counter Store: %s destroyed.... BOOOM" % storeName)

    else:
        Base.error("Counter Store: %s did not exist... Moving on cuz that is how we roll" % storeName)
开发者ID:xebialabs-community,项目名称:xlr-release-profile-plugin,代码行数:18,代码来源:ReleaseCounter.py


注:本文中的Base.Base.info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。