• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python printer.out函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: get_image_to_publish

def get_image_to_publish(image_object, builder, template, appliance, counter):
    printer.out(
        "Publishing '" + builder["type"] + "' image (" + str(counter) + "/" + str(len(template["builders"])) + ")")
    images = image_object.api.Users(image_object.login).Appliances(appliance.dbId).Images.Getall(
        Query="targetFormat.name=='" + builder["type"] + "'")
    images = images.images.image
    if images is None or len(images) == 0:
        raise ValueError(
            "No images found for the template '" + template["stack"]["name"] + "' with type: " + builder["type"])

    images_ready = []
    for image in images:
        isOk = is_image_ready_to_publish(image, builder)
        if isOk:
            images_ready.append(image)

    if (len(images_ready) == 0):
        raise ValueError(
            "No images found for the template '" + template["stack"]["name"] + "' with type: " + builder["type"])
    elif (len(images_ready) == 1):
        image_ready = images_ready[0]
    else:
        image_ready = images_ready[0]

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


示例17: do_delete

    def do_delete(self, args):
        try:
            #add arguments
            doParser = self.arg_delete()
            try:
                doArgs = doParser.parse_args(args.split())
            except SystemExit as e:
                return
            #call UForge API
            printer.out("Searching template with id ["+doArgs.id+"] ...")
            myAppliance = self.api.Users(self.login).Appliances(doArgs.id).Get()
            if myAppliance is None or type(myAppliance) is not Appliance:
                printer.out("Template not found")
            else:
                table = Texttable(800)
                table.set_cols_dtype(["t","t","t","t","t","t","t","t","t","t"])
                table.header(["Id", "Name", "Version", "OS", "Created", "Last modified", "# Imgs", "Updates", "Imp", "Shared"])
                table.add_row([myAppliance.dbId, myAppliance.name, str(myAppliance.version), myAppliance.distributionName+" "+myAppliance.archName,
                               myAppliance.created.strftime("%Y-%m-%d %H:%M:%S"), myAppliance.lastModified.strftime("%Y-%m-%d %H:%M:%S"), len(myAppliance.imageUris.uri),myAppliance.nbUpdates, "X" if myAppliance.imported else "", "X" if myAppliance.shared else ""])
                print table.draw() + "\n"

                if doArgs.no_confirm:
                    self.api.Users(self.login).Appliances(myAppliance.dbId).Delete()
                    printer.out("Template deleted", printer.OK)
                elif generics_utils.query_yes_no("Do you really want to delete template with id "+str(myAppliance.dbId)):
                    self.api.Users(self.login).Appliances(myAppliance.dbId).Delete()
                    printer.out("Template deleted", printer.OK)
            return 0
        except ArgumentParserError as e:
            printer.out("ERROR: In Arguments: "+str(e), printer.ERROR)
            self.help_delete()
        except Exception as e:
            return handle_uforge_exception(e)
开发者ID:ShigeruIchihashi,项目名称:hammr,代码行数:33,代码来源:template.py


示例18: check_mandatory_create_account

def check_mandatory_create_account(iterables, type):
    #iterables can be builders or accounts
    for iterable in iterables:
        if type=="builders":
            if  "account" in iterable:
                if not "type" in iterable and not "type" in iterable["account"]:
                    printer.out("no attribute type in builder", printer.ERROR)
                    return
                if "file" in iterable["account"]:
                    file = get_file(iterable["account"]["file"])
                    if file is None:
                        return 2
                    data = load_data(file)
                    if data is None:
                        return 2
                    if "accounts" in data:
                        return check_mandatory_create_account(data["accounts"], "accounts")
        if type=="accounts":
            if not "type" in iterable:
                printer.out("no attribute type in accounts", printer.ERROR)
                return

                #TODO

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


示例19: 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 subscription profiles for organization ...")
            org = org_utils.org_get(self.api, org_name)
            print org
            subscriptions = self.api.Orgs(org.dbId).Subscriptions().Getall(None)

            table = Texttable(200)
            table.set_cols_align(["c", "c", "c", "c"])
            table.header(["Name", "Code", "Active", "description"])
            for subscription in subscriptions.subscriptionProfiles.subscriptionProfile:
                table.add_row([subscription.name, subscription.code, "X" if subscription.active else "",
                               subscription.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,代码行数:30,代码来源:subscriptionprofilecmds.py


示例20: 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)
                        if org is None:
                                printer.out("There is no organization matching ["+doArgs.org+"].", printer.OK)
                                return 0

                        printer.out("Getting target platform with id ["+doArgs.id+"] for ["+org.name+"] . . .")
                        targetPlatform = self.api.Orgs(org.dbId).Targetplatforms(doArgs.id).Get()
                        if targetPlatform is None:
                                printer.out("targetPlatform with id "+ doArgs.id +" does not exist", printer.ERROR)
                                return 2
                        else:
                                result = self.api.Orgs(org.dbId).Targetplatforms(doArgs.id).Delete()
                                printer.out("Target Platform ["+targetPlatform.name+"] has successfully 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,代码行数:26,代码来源:org_targetPlatform.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ustruct.pack函数代码示例发布时间:2022-05-27
下一篇:
Python generics_utils.query_yes_no函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap