File: cloud.py

package info (click to toggle)
python-azure 20230112%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 749,544 kB
  • sloc: python: 6,815,827; javascript: 287; makefile: 195; xml: 109; sh: 105
file content (30 lines) | stat: -rw-r--r-- 1,162 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------

def get_cli_active_cloud():
    """Return a CLI active cloud.

    *Disclaimer*: This method is not working for azure-cli-core>=2.21.0 (released in March 2021).

    .. versionadded:: 1.1.6

    .. deprecated:: 1.1.28

    :return: A CLI Cloud
    :rtype: azure.cli.core.cloud.Cloud
    :raises: ImportError if azure-cli-core package is not available
    """

    try:
        from azure.cli.core.cloud import get_active_cloud
    except ImportError:
        raise ImportError(
            "The public API of azure-cli-core has been deprecated starting 2.21.0, " +
            "and this method no longer can return a cloud instance. " +
            "If you want to use this method, you need to install 'azure-cli-core<2.21.0'. " +
            "You may corrupt data if you use current CLI and old azure-cli-core."
        )
    return get_active_cloud()