當前位置: 首頁>>代碼示例>>Python>>正文


Python Default.list方法代碼示例

本文整理匯總了Python中cloudmesh_client.cloud.default.Default.list方法的典型用法代碼示例。如果您正苦於以下問題:Python Default.list方法的具體用法?Python Default.list怎麽用?Python Default.list使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cloudmesh_client.cloud.default.Default的用法示例。


在下文中一共展示了Default.list方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_001

# 需要導入模塊: from cloudmesh_client.cloud.default import Default [as 別名]
# 或者: from cloudmesh_client.cloud.default.Default import list [as 別名]
 def test_001(self):
     """
     delete defaults
     :return:
     """
     HEADING()
     Default.clear()
     assert Default.list() == None
開發者ID:atavism,項目名稱:client,代碼行數:10,代碼來源:test_default.py

示例2: test_002

# 需要導入模塊: from cloudmesh_client.cloud.default import Default [as 別名]
# 或者: from cloudmesh_client.cloud.default.Default import list [as 別名]
    def test_002(self):
        """
        set default cloud
        :return:
        """
        HEADING()
        result = Default.list()
        print(result)

        name = "mycloud"
        Default.set_cloud(name)

        result = Default.list()
        print(result)

        print    ("KKK", Default.get_cloud())


        assert Default.get_cloud() == name
        self._check(name)
開發者ID:atavism,項目名稱:client,代碼行數:22,代碼來源:test_default.py

示例3: do_default

# 需要導入模塊: from cloudmesh_client.cloud.default import Default [as 別名]
# 或者: from cloudmesh_client.cloud.default.Default import list [as 別名]
    def do_default(self, args, arguments):
        """
        ::

          Usage:
              default list [--cloud=CLOUD] [--format=FORMAT] [--all]
              default delete KEY [--cloud=CLOUD]
              default KEY [--cloud=CLOUD]
              default KEY=VALUE [--cloud=CLOUD]

          Arguments:

            KEY    the name of the default
            VALUE  the value to set the key to

          Options:

             --cloud=CLOUD    the name of the cloud
             --format=FORMAT  the output format [default: table]
             --all            lists all the default values

        Description:


            Cloudmesh has the ability to manage easily multiple
            clouds. One of the key concepts to make the list of such
            clouds easier is the introduction of defaults for each
            cloud or globally. Hence it is possible to set default
            images, flavors for each cloud, and also the default
            cloud. The default command is used to set and list the
            default values. These defaults are used in other commands
            if they are not overwritten by a command parameter.


        The current default values can by listed with --all option:(
        if you have a default cloud specified. You can also add a
        cloud parameter to apply the command to a specific cloud)

               default list

            A default can be set with

                default KEY=VALUE

            To look up a default value you can say

                default KEY

            A default can be deleted with

                default delete KEY


        Examples:
            default list --all
            default list --cloud=general
            default image=xyz
            default image=abc --cloud=kilo
            default image
            default image --cloud=kilo
            default delete image
            default delete image --cloud=kilo
        """
        # pprint(arguments)

        """
        For these keys, the 'cloud' column in db
        will always be 'general'.
        """
        general_keys = ["cloud", "cluster", "queue"]

        """
        If the default cloud has been set (eg. default cloud=xxx),
        then subsequent defaults for any key (eg. default image=yyy),
        will have 'cloud' column in db as the default cloud that was set.
        (eg. image=yyy for cloud=xxx).
        """

        if arguments["KEY"] in general_keys:
            cloud = "general"
        else:
            cloud = arguments["--cloud"] or Default.get("cloud", "general") or "general"

        if arguments["list"]:
            output_format = arguments["--format"]

            if arguments['--all'] or arguments["--cloud"] is None:
                cloud = None
            result = Default.list(cloud=cloud, format=output_format)

            if result is None:
                Console.error("No default values found")
            else:
                print(result)
            return ""

        elif arguments["delete"]:

            key = arguments["KEY"]
            result = Default.delete(key, cloud)
#.........這裏部分代碼省略.........
開發者ID:atavism,項目名稱:client,代碼行數:103,代碼來源:DefaultCommand.py

示例4: _check

# 需要導入模塊: from cloudmesh_client.cloud.default import Default [as 別名]
# 或者: from cloudmesh_client.cloud.default.Default import list [as 別名]
 def _check(self, content):
     result = Default.list()
     print(result)
     assert content in str(result)
開發者ID:atavism,項目名稱:client,代碼行數:6,代碼來源:test_default.py

示例5: do_default

# 需要導入模塊: from cloudmesh_client.cloud.default import Default [as 別名]
# 或者: from cloudmesh_client.cloud.default.Default import list [as 別名]
    def do_default(self, args, arguments):
        """
        ::

          Usage:
              default
              default list [--cloud=CLOUD] [--format=FORMAT] [--all]
              default delete KEY [--cloud=CLOUD]
              default KEY [--cloud=CLOUD]
              default KEY=VALUE [--cloud=CLOUD]

          Arguments:
            KEY    the name of the default
            VALUE  the value to set the key to

          Options:
             --cloud=CLOUD    the name of the cloud
             --format=FORMAT  the output format. Values include
                              table, json, csv, yaml. [default: table]
             --all            lists all the default values

        Description:
            Cloudmesh has the ability to manage easily multiple
            clouds. One of the key concepts to manage multiple clouds
            is to use defaults for the cloud, the images, flavors,
            and other values. The default command is used to manage
            such default values. These defaults are used in other commands
            if they are not overwritten by a command parameter.

            The current default values can by listed with

                default list --all

            Via the default command you can list, set, get and delete
            default values. You can list the defaults with

               default list

            A default can be set with

                default KEY=VALUE

            To look up a default value you can say

                default KEY

            A default can be deleted with

                default delete KEY

            To be specific to a cloud you can specify the name of the
            cloud with the --cloud=CLOUD option. The list command can
            print the information in various formats iv specified.

        Examples:
            default
                lists the default for the current default cloud

            default list --all
                lists all default values

            default list --cloud=kilo
                lists the defaults for the cloud with the name kilo

            default image=xyz
                sets the default image for the default cloud to xyz

            default image=abc --cloud=kilo
                sets the default image for the cloud kilo to xyz

            default image
                list the default image of the default cloud

            default image --cloud=kilo
                list the default image of the cloud kilo

            default delete image
                deletes the value for the default image in the
                default cloud

            default delete image --cloud=kilo
                deletes the value for the default image in the
                cloud kilo

        """
        # pprint(arguments)

        """
        For these keys, the 'cloud' column in db
        will always be 'general'.
        """
        general_keys = ["cloud", "cluster", "queue"]

        """
        If the default cloud has been set (eg. default cloud=xxx),
        then subsequent defaults for any key (eg. default image=yyy),
        will have 'cloud' column in db as the default cloud that was set.
        (eg. image=yyy for cloud=xxx).
        """

#.........這裏部分代碼省略.........
開發者ID:rajaramcomputers,項目名稱:client,代碼行數:103,代碼來源:DefaultCommand.py


注:本文中的cloudmesh_client.cloud.default.Default.list方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。