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


Python printer.out函数代码示例

本文整理汇总了Python中ussclicore.utils.printer.out函数的典型用法代码示例。如果您正苦于以下问题:Python out函数的具体用法?Python out怎么用?Python out使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: publish_abiquo

def publish_abiquo(pimage, builder):
    # doing field verification
    if not "enterprise" in builder:
        printer.out("enterprise in abiquo builder not found", printer.ERROR)
        return
    if not "datacenter" in builder:
        printer.out("datacenter in abiquo builder not found", printer.ERROR)
        return
    if not "productName" in builder:
        printer.out("productName in abiquo builder not found", printer.ERROR)
        return
    if not "category" in builder:
        printer.out("category in abiquo builder not found", printer.ERROR)
        return
    if not "description" in builder:
        printer.out("description in abiquo builder not found", printer.ERROR)
        return

    pimage.credAccount.datacenterName = builder["datacenter"]
    pimage.credAccount.displayName = builder["productName"]
    pimage.credAccount.category = builder["category"]
    pimage.credAccount.organizationName = builder["enterprise"]
    pimage.credAccount.description = builder["description"]

    return pimage
开发者ID:DimitriSCOLE,项目名称:hammr,代码行数:25,代码来源:publish_utils.py

示例2: publish_vcenter

def publish_vcenter(builder):
    pimage = PublishImageVSphere()

    # doing field verification
    if not "datastore" in builder:
        printer.out("datastore in vcenter builder not found", printer.ERROR)
        return
    if not "datacenterName" in builder:
        printer.out("datacenterName in vcenter builder not found", printer.ERROR)
        return
    if not "clusterName" in builder:
        printer.out("clusterName in vcenter builder not found", printer.ERROR)
        return
    if not "displayName" in builder:
        printer.out("displayName in vcenter builder not found", printer.ERROR)
        return
    if not "network" in builder:
        printer.out("network in vcenter builder not found", printer.ERROR)
        return

    pimage.datastore = builder["datastore"]
    pimage.datacenterName = builder["datacenterName"]
    pimage.clusterName = builder["clusterName"]
    pimage.displayName = builder["displayName"]
    pimage.network = builder["network"]
    return pimage
开发者ID:DimitriSCOLE,项目名称:hammr,代码行数:26,代码来源:publish_utils.py

示例3: fill_azure

def fill_azure(account):
    myCredAccount = azure()
    # doing field verification
    if not "name" in account:
        printer.out("name for azure account not found", printer.ERROR)
        return
    if not "tenantId" in account:
        printer.out("no tenant id found", printer.ERROR)
        return
    if not "subscriptionId" in account:
        printer.out("no subscription id found", printer.ERROR)
        return
    if not "applicationId" in account:
        printer.out("no application id found", printer.ERROR)
        return
    if not "applicationKey" in account:
        printer.out("no application key found", printer.ERROR)
        return

    myCredAccount.name = account["name"]
    myCredAccount.tenantId = account["tenantId"]
    myCredAccount.subscriptionId = account["subscriptionId"]
    myCredAccount.applicationId = account["applicationId"]
    myCredAccount.applicationKey = account["applicationKey"]

    return myCredAccount
开发者ID:lqueiroga,项目名称:hammr,代码行数:26,代码来源:account_utils.py

示例4: publish_azure

def publish_azure(builder):
    if not "storageAccount" in builder:
        printer.out("Azure Resource Manager publish")
        return publish_azure_arm(builder)
    else:
        printer.out("Azure classic publish")
        return publish_azure_classic(builder)
开发者ID:DimitriSCOLE,项目名称:hammr,代码行数:7,代码来源:publish_utils.py

示例5: generate_openshift

def generate_openshift(image, builder, install_profile, api=None, login=None):
    if not "entrypoint" in builder:
        printer.out("Entrypoint for OpenShift image has not been specified", printer.ERROR)
        return None, None
    image.entrypoint = str(builder["entrypoint"])
    image.compress = True
    return image, install_profile
开发者ID:lqueiroga,项目名称:hammr,代码行数:7,代码来源:generate_utils.py

示例6: print_uforge_exception

def print_uforge_exception(e):
    if type(e) is UForgeException:
        printer.out(e.value, printer.ERROR)
    elif len(e.args) >= 1 and type(e.args[0]) is UForgeError:
        printer.out(get_uforge_exception(e), printer.ERROR)
    else:
        traceback.print_exc()
开发者ID:jfknoepfli,项目名称:marketplace-cli,代码行数:7,代码来源:marketplace_utils.py

示例7: do_info_draw_publication

    def do_info_draw_publication(self, info_image):
        printer.out("Information about publications:")
        pimages = self.api.Users(self.login).Pimages.Getall()
        table = Texttable(0)
        table.set_cols_align(["l", "l"])

        has_pimage = False
        for pimage in pimages.publishImages.publishImage:
            if pimage.imageUri == info_image.uri:
                has_pimage = True
                cloud_id = None
                publish_status = image_utils.get_message_from_status(pimage.status)
                if not publish_status:
                    publish_status = "Publishing"

                if publish_status == "Done":
                    cloud_id = pimage.cloudId
                    format_name = info_image.targetFormat.format.name
                    if format_name == "docker" or format_name == "openshift":
                        cloud_id = pimage.namespace + "/" + pimage.repositoryName + ":" + pimage.tagName

                table.add_row([publish_status, cloud_id])

        if has_pimage:
            table.header(["Status", "Cloud Id"])
            print table.draw() + "\n"
        else:
            printer.out("No publication")
开发者ID:usharesoft,项目名称:hammr,代码行数:28,代码来源:image.py

示例8: print_publish_status

def print_publish_status(image_object, source, image, published_image, builder, account_name):
    status = published_image.status
    statusWidget = progressbar_widget.Status()
    statusWidget.status = status
    widgets = [Bar('>'), ' ', statusWidget, ' ', ReverseBar('<')]
    progress = ProgressBar(widgets=widgets, maxval=100).start()
    while not (status.complete or status.error or status.cancelled):
        statusWidget.status = status
        progress.update(status.percentage)
        status = call_status_publish_webservice(image_object, source, image, published_image)
        time.sleep(2)
    statusWidget.status = status
    progress.finish()
    if status.error:
        printer.out("Publication to '" + builder["account"][
            "name"] + "' error: " + status.message + "\n" + status.errorMessage, printer.ERROR)
        if status.detailedError:
            printer.out(status.detailedErrorMsg)
    elif status.cancelled:
        printer.out("\nPublication to '" + builder["account"][
            "name"] + "' canceled: " + status.message.printer.WARNING)
    else:
        printer.out("Publication to " + account_name + " is ok", printer.OK)
        published_image = image_object.get_publish_image_from_publish_id(published_image.dbId)
        if published_image.cloudId is not None and published_image.cloudId != "":
            printer.out("Cloud ID : " + published_image.cloudId)
开发者ID:jgweir,项目名称:hammr,代码行数:26,代码来源:publish_utils.py

示例9: do_list

        def do_list(self, args):
                try:
                        doParser = self.arg_list()
                        doArgs = doParser.parse_args(shlex.split(args))

                        org = org_utils.org_get(self.api, doArgs.org)
                        printer.out("Getting user list for ["+org.name+"] . . .")
                        allUsers = self.api.Orgs(org.dbId).Members.Getall()
                        allUsers = order_list_object_by(allUsers.users.user, "loginName")

                        table = Texttable(200)
                        table.set_cols_align(["l", "l", "c"])
                        table.header(["Login", "Email", "Active"])

                        for item in allUsers:
                                if item.active:
                                        active = "X"
                                else:
                                        active = ""
                                table.add_row([item.loginName, item.email, active])

                        print table.draw() + "\n"
                        return 0

                except ArgumentParserError as e:
                        printer.out("In Arguments: "+str(e), printer.ERROR)
                        self.help_list()
                except Exception as e:
                        return handle_uforge_exception(e)
开发者ID:DimitriSCOLE,项目名称:uforge-cli,代码行数:29,代码来源:org_user.py

示例10: do_list

    def do_list(self, args):
        try:
            org_name = None
            if args:
                do_parser = self.arg_list()
                try:
                    do_args = do_parser.parse_args(shlex.split(args))
                except SystemExit as e:
                    return
                org_name = do_args.org

            # call UForge API
            printer.out("Getting all the roles for the organization...")
            org = org_utils.org_get(self.api, org_name)
            all_roles = self.api.Orgs(org.dbId).Roles().Getall(None)

            table = Texttable(200)
            table.set_cols_align(["c", "c"])
            table.header(["Name", "Description"])
            for role in all_roles.roles.role:
                table.add_row([role.name, role.description])
            print table.draw() + "\n"
            return 0
        except ArgumentParserError as e:
            printer.out("ERROR: In Arguments: " + str(e), printer.ERROR)
            self.help_list()
        except Exception as e:
            return marketplace_utils.handle_uforge_exception(e)
开发者ID:hugo6,项目名称:marketplace-cli,代码行数:28,代码来源:rolecmds.py

示例11: do_delete

    def do_delete(self, args):
        try:
            doParser = self.arg_delete()
            doArgs = doParser.parse_args(shlex.split(args))

            if not doArgs:
                return 2

            # call UForge API
            printer.out("Retrieving migration with id [" + doArgs.id + "]...")

            migration = self.api.Users(self.login).Migrations(doArgs.id).Get()

            if migration is None:
                printer.out("No migration available with id " + doArgs.id)
                return 2

            print migration_utils.migration_table([migration]).draw() + "\n"

            if doArgs.no_confirm or generics_utils.query_yes_no(
                                    "Do you really want to delete migration with id " + doArgs.id + "?"):
                printer.out("Please wait...")
                self.api.Users(self.login).Migrations(doArgs.id).Delete()
                printer.out("Migration deleted", printer.OK)

        except ArgumentParserError as e:
            printer.out("ERROR: In Arguments: " + str(e), printer.ERROR)
            self.help_delete()
        except Exception as e:
            return hammr_utils.handle_uforge_exception(e)
开发者ID:lqueiroga,项目名称:hammr,代码行数:30,代码来源:migration.py

示例12: do_list

        def do_list(self, args):
                try:
                        doParser = self.arg_list()
                        doArgs = doParser.parse_args(shlex.split(args))
                        org = org_utils.org_get(self.api, doArgs.org)

                        # call UForge API
                        printer.out("Getting all the subscription profiles for organization ...")
                        subscriptions = self.api.Orgs(org.dbId).Subscriptions().Getall(Search=None)
                        subscriptions = generics_utils.order_list_object_by(subscriptions.subscriptionProfiles.subscriptionProfile, "name")
                        if subscriptions is None or len(subscriptions) == 0:
                                printer.out("There is no subscriptions in [" + org.name + "] ")
                                return 0
                        printer.out("List of subscription profiles in [" + org.name + "] :")
                        table = Texttable(200)
                        table.set_cols_align(["c", "c", "c", "c"])
                        table.header(["Name", "Code", "Active", "description"])
                        for subscription in subscriptions:
                                if subscription.active:
                                        active = "X"
                                else:
                                        active = ""
                                table.add_row([subscription.name, subscription.code, active, subscription.description])
                        print table.draw() + "\n"
                        printer.out("Foumd " + str(len(subscriptions)) + " subscription profile(s).")
                        return 0

                except ArgumentParserError as e:
                        printer.out("ERROR: In Arguments: " + str(e), printer.ERROR)
                        self.help_list()
                except Exception as e:
                        return handle_uforge_exception(e)
开发者ID:DimitriSCOLE,项目名称:uforge-cli,代码行数:32,代码来源:subscription.py

示例13: recursivelyAppendToArchive

def recursivelyAppendToArchive(bundle, files, parentDir, checkList, archive_files):
    #must save the filepath before changing it after archive
    filePathBeforeTar = files["source"]
    if not "tag" in files or ("tag" in files and files["tag"] != "ospkg"):
        if files["source"] not in checkList:
            #add the source path to the check list
            checkList.append(files["source"])
            #if parentDir is a no empty path, add os.sep after. Else keep it as ""
            if parentDir:
                parentDir = parentDir + os.sep

            #add to list of file to tar
            file_tar_path=constants.FOLDER_BUNDLES + os.sep + generics_utils.remove_URI_forbidden_char(bundle["name"]) + os.sep + generics_utils.remove_URI_forbidden_char(bundle["version"]) + os.sep + parentDir + generics_utils.remove_URI_forbidden_char(ntpath.basename(files["source"]))
            archive_files.append([file_tar_path,files["source"]])
            #changing source path to archive related source path
            files["source"]=file_tar_path
        else:
            printer.out("found two files with the same source path in the bundles section...", printer.ERROR)
            return 2

    if "files" in files:
        for subFiles in files["files"]:
            checkList,archive_files = recursivelyAppendToArchive(bundle, subFiles, parentDir + ntpath.basename(files["source"]), checkList, archive_files)

    if (not "tag" in files or files["tag"] != "ospkg") and os.path.isdir(filePathBeforeTar):
        checkList,archive_files = processFilesFromFolder(bundle, files, filePathBeforeTar, parentDir + ntpath.basename(filePathBeforeTar), checkList, archive_files)

    return checkList, archive_files
开发者ID:MaxTakahashi,项目名称:hammr,代码行数:28,代码来源:bundle_utils.py

示例14: do_delete

        def do_delete(self, args):
                try:
                        doParser = self.arg_delete()
                        doArgs = doParser.parse_args(shlex.split(args))

                        org = org_utils.org_get(self.api, doArgs.org)
                        allCategory = self.api.Orgs(org.dbId).Categories.Getall()
                        allCategory = allCategory.categories.category

                        deleteList = []
                        if doArgs.name is not None:
                                for arg1 in doArgs.name:
                                        for item in allCategory:
                                                if arg1 == item.name:
                                                        deleteList.append(item)
                                                        break
                        if doArgs.ids is not None:
                                for arg2 in doArgs.ids:
                                        for item2 in allCategory:
                                                if long(arg2) == item2.dbId:
                                                        deleteList.append(item2)
                                                        break

                        for item3 in deleteList:
                                result = self.api.Orgs(org.dbId).Categories.Delete(Id=item3.dbId)
                                printer.out("Category ["+item3.name+"] has been deleted.", printer.OK)
                        return 0

                except ArgumentParserError as e:
                        printer.out("In Arguments: "+str(e), printer.ERROR)
                        self.help_delete()
                except Exception as e:
                        return handle_uforge_exception(e)
开发者ID:DimitriSCOLE,项目名称:uforge-cli,代码行数:33,代码来源:org_category.py

示例15: publish_azure

def publish_azure(builder):
    if "blob" in builder or "container" in builder:
        printer.out("Azure Resource Manager publish")
        return publish_azure_arm(builder)
    else:
        printer.out("Azure classic publish")
        return publish_azure_classic(builder)
开发者ID:cinlloc,项目名称:hammr,代码行数:7,代码来源:publish_utils.py


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