From 5a83404f5a1ad2613a281768613a316e8da00832 Mon Sep 17 00:00:00 2001 From: Mike Ross Date: Fri, 26 Oct 2018 10:44:09 -0700 Subject: [PATCH] Releasing version 2.4.36 (#99) --- CHANGELOG.rst | 8 +- scripts/examples/compartment_example.sh | 115 ++++++++++++++++++ scripts/examples/nat_gateway_example.sh | 84 +++++++++++++ scripts/install/install.py | 2 +- src/oci_cli/cli_util.py | 45 +++++-- src/oci_cli/extended/core_cli_extended.py | 2 +- src/oci_cli/json_skeleton_utils.py | 6 +- src/oci_cli/scripts/database/dbaas.py | 12 +- src/oci_cli/version.py | 2 +- tests/output/inline-help/audit.txt | 2 +- tests/output/inline-help/bv.txt | 2 +- tests/output/inline-help/ce.txt | 2 +- .../output/inline-help/compute-management.txt | 2 +- tests/output/inline-help/compute.txt | 2 +- tests/output/inline-help/db.txt | 2 +- tests/output/inline-help/dns.txt | 2 +- tests/output/inline-help/email.txt | 2 +- tests/output/inline-help/fs.txt | 2 +- tests/output/inline-help/iam.txt | 2 +- tests/output/inline-help/kms.txt | 2 +- tests/output/inline-help/lb.txt | 2 +- tests/output/inline-help/network.txt | 2 +- tests/output/inline-help/os.txt | 2 +- tests/output/inline-help/search.txt | 2 +- tests/output/inline-help/setup.txt | 2 +- tests/test_compute.py | 2 +- tests/unit/test_cli_util.py | 10 ++ 27 files changed, 279 insertions(+), 41 deletions(-) create mode 100755 scripts/examples/compartment_example.sh create mode 100755 scripts/examples/nat_gateway_example.sh diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9b30ffff6..ff8d8b390 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,12 @@ All notable changes to this project will be documented in this file. The format is based on `Keep a Changelog `__. +2.4.36 - 2018-10-26 +--------------------- +Fixed +~~~~~~~ +* Fix malformed instance metadata keys for ``oci compute-management instance-configuration create`` and ``oci compute-management instance-configuration launch-compute-instance``. This was preventing SSH access to instances created through these commands. + 2.4.35 - 2018-10-18 --------------------- Added @@ -64,7 +70,7 @@ Changed * New Attribute ``allConnectionStrings`` is included in the GET Response for Autonomous Transaction Processing Database and Autonomous Data Warehouse. Known Issues -~~~~~~~~~~~~ +~~~~~~~~ * Block Storage service for copying volume backups across regions is not enabled. 2.4.34 - 2018-10-04 diff --git a/scripts/examples/compartment_example.sh b/scripts/examples/compartment_example.sh new file mode 100755 index 000000000..ae6872068 --- /dev/null +++ b/scripts/examples/compartment_example.sh @@ -0,0 +1,115 @@ +#!/bin/bash +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +# This script provides an example of how to use compartments in the CLI in terms of: +# +# - Managing compartments by performing create, read (get/list) operations on them. +# +# WARNING: Compartments currently does not supporting the hard delete. Once you created the compartments with the script, you cannot hard delete them. +# WARNING: Compartments supported operations can be found https://docs.cloud.oracle.com/iaas/api/#/en/identity/20160918/Compartment/. +# +# Requirements for running this script: +# - OCI CLI v2.4.35 or later (you can check this by running oci --version). +# - jq (https://stedolan.github.io/jq/) for JSON querying and manipulation of CLI output. This may be a useful utility in general +# and may help cater to scenarios which can't be wholly addressed by the --query option in the CLI. + +TENANCY_ID="" # Your tenancy ID + +# script to exit on first error +set -e + +########################################################## +# Setup the compartments like the following tree +# Here is the compartment Tree in this Test +# Tenancy +# | +# --- CP-1 +# | +# | +# --- CP-2 +# | | +# | --- CP-21 +# | | +# | --- CP-211 +# | +# --- CP-3 +# | +# --- CP-31 +########################################################## + +echo "WARNING: Compartments currently does not supporting the hard delete.Once you created the compartments with the script, you cannot hard delete them" +echo "WARNING: Compartments supported operations can be found https://docs.cloud.oracle.com/iaas/api/#/en/identity/20160918/Compartment/" + +# Create first level of compartments (CP1, CP2, CP3) +echo "Creating Compartment CP1" +CREATED_COMPARTMENT=$(oci iam compartment create --compartment-id $TENANCY_ID --name CP-1 --description "CP1") +COMPARTMENT_CP1_ID=$(jq -r '.data.id' <<< "$CREATED_COMPARTMENT") +echo "Compartment-CP1 OCID: ${COMPARTMENT_CP1_ID}" + +echo "Creating Compartment CP2" +CREATED_COMPARTMENT=$(oci iam compartment create --compartment-id $TENANCY_ID --name CP-2 --description "CP2") +COMPARTMENT_CP2_ID=$(jq -r '.data.id' <<< "$CREATED_COMPARTMENT") +echo "Compartment-CP2 OCID: ${COMPARTMENT_CP2_ID}" + +echo "Creating Compartment CP3" +CREATED_COMPARTMENT=$(oci iam compartment create --compartment-id $TENANCY_ID --name CP-3 --description "CP3") +COMPARTMENT_CP3_ID=$(jq -r '.data.id' <<< "$CREATED_COMPARTMENT") +echo "Compartment-CP3 OCID: ${COMPARTMENT_CP3_ID}" + +# List first level compartments under tenancy +echo "List Compartments under Tenancy" +LIST_COMPARTMENTS=$(oci iam compartment list --compartment-id $TENANCY_ID) + +echo "List Compartments under Tenancy with accessibleLevel == accessible" +LIST_COMPARTMENTS=$(oci iam compartment list --compartment-id $TENANCY_ID --access-level accessible) + + +# If we create/update and then try to use compartments straight away, sometimes we can get a 404. To try and avoid this, the script +# adds a short delay between the compartment management operations. +# Also sleep is not needed but kept as a safety measure for worst case for data plane sync with control plan changes. +sleep 10 + +# Create second level of compartments (CP21, CP31) +echo "Creating Compartment CP21 under CP2" +CREATED_COMPARTMENT=$(oci iam compartment create --compartment-id $COMPARTMENT_CP2_ID --name CP-21 --description "CP21") +COMPARTMENT_CP21_ID=$(jq -r '.data.id' <<< "$CREATED_COMPARTMENT") +echo "Compartment-CP21 OCID: ${COMPARTMENT_CP21_ID}" + +echo "Creating Compartment CP31 under CP3" +CREATED_COMPARTMENT=$(oci iam compartment create --compartment-id $COMPARTMENT_CP3_ID --name CP-31 --description "CP31") +COMPARTMENT_CP31_ID=$(jq -r '.data.id' <<< "$CREATED_COMPARTMENT") +echo "Compartment-CP31 OCID: ${COMPARTMENT_CP31_ID}" + + +# If we create/update and then try to use compartments straight away, sometimes we can get a 404. To try and avoid this, the script +# adds a short delay between the compartment management operations. +# Also sleep is not needed but kept as a safety measure for worst case for data plane sync with control plan changes. +sleep 10 + +# Create third level of compartments (CP211) +echo "Creating Compartment CP211 under CP21" +CREATED_COMPARTMENT=$(oci iam compartment create --compartment-id $COMPARTMENT_CP21_ID --name CP-211 --description "CP211") +COMPARTMENT_CP211_ID=$(jq -r '.data.id' <<< "$CREATED_COMPARTMENT") +echo "Compartment-CP21 OCID: ${COMPARTMENT_CP211_ID}" + + +# List all level compartments under tenancy +echo "List Compartments under Tenancy with compartment-id-in-subtree == true" +LIST_COMPARTMENTS=$(oci iam compartment list --compartment-id $TENANCY_ID --compartment-id-in-subtree true) + +# List all level compartments under tenancy with accessLevel == Accessible +echo "List Compartments under Tenancy with compartment-id-in-subtree == true and accessLevel == accessible" +LIST_COMPARTMENTS=$(oci iam compartment list --compartment-id $TENANCY_ID --access-level accessible --compartment-id-in-subtree true) + +# List first level compartments under CP2 +echo "List Compartments under CP2" +LIST_COMPARTMENTS=$(oci iam compartment list --compartment-id $COMPARTMENT_CP2_ID) + +# List first level compartments under CP21 +echo "List Compartments under CP21" +LIST_COMPARTMENTS=$(oci iam compartment list --compartment-id $COMPARTMENT_CP21_ID) + +# List first level compartments under CP3 +echo "List Compartments under CP3" +LIST_COMPARTMENTS=$(oci iam compartment list --compartment-id $COMPARTMENT_CP3_ID) + +echo "DONE" diff --git a/scripts/examples/nat_gateway_example.sh b/scripts/examples/nat_gateway_example.sh new file mode 100755 index 000000000..09437fb3e --- /dev/null +++ b/scripts/examples/nat_gateway_example.sh @@ -0,0 +1,84 @@ +#!/bin/bash +# This script provides a basic example of how to use the Nat Gateway service in the CLI. +# The two variables at the beginning of the script must be specified accordingly: +# +# * COMPARTMENT_ID: The OCID of the compartment where we'll create our file system and related resources +# +# The script will demonstrate: +# +# * Creating a new nat gateway +# * Getting a nat gateway +# * Updating a nat gateway +# * Deleting a nat gateway +# +# +# Requirements for running this script: +# - OCI CLI v2.4.34 or later (you can check this by running oci --version) +# - jq (https://stedolan.github.io/jq/) for JSON querying of CLI output. This may be a useful utility in general and may help cater to scenarios +# which can't be wholly addressed by the --query option in the CLI + +set -e + +COMPARTMENT_ID="" + +# First we will create a VCN and a subnet. Since these resources have a lifecycle state, we can create them and use +# the --wait-for-state option so that our command will only return/complete when the resouce enters the desired +# state (in this case AVAILABLE) +VCN_ID=$(oci network vcn create -c $COMPARTMENT_ID --display-name createNatgwExampleVcn --cidr-block 10.0.0.0/16 --wait-for-state AVAILABLE --query 'data.id' --raw-output 2>/dev/null) +echo "VCN OCID: ${VCN_ID}" + +echo +# First we create a nat gateway. A nat gateway has a lifecycle state so we can use the --wait-for-state +# option so that our command will only return/complete when the nat gateway reaches the desired state. +NAT_GATEWAY_ID=$(oci network nat-gateway create -c $COMPARTMENT_ID --vcn-id $VCN_ID --display-name exampleNatGateway --wait-for-state AVAILABLE --query data.id --raw-output) +echo "Nat Gateway OCID: $NAT_GATEWAY_ID" +echo "" + +# Update routing for the subnet by creating a route table with a route rule that directs internet-bound traffic to the Nat Gateway +# Create route table and wait for it to become available +ROUTE_RULE='[{"cidrBlock":"0.0.0.0/0","networkEntityId":"'${NAT_GATEWAY_ID}'"}]' +echo "Create route table and add Nat Gateway rule" +echo "=========================" +ROUTE_TABLE_ID=$(oci network route-table create -c $COMPARTMENT_ID --route-rules $ROUTE_RULE --vcn-id $VCN_ID --wait-for-state AVAILABLE --query data.id --raw-output) +echo "Route Table OCID: $ROUTE_TABLE_ID" +echo "" + +# We can show the route table directed to the nat gateway +echo "Get route table" +echo "=========================" +oci network route-table get --rt-id $ROUTE_TABLE_ID +echo "" + +# We can list all nat gateways in a compartment. This is a paginated call and we can use the --all option to get +# all results rather than having to manually deal with page tokens +echo "Listing all nat gateways" +echo "=========================" +oci network nat-gateway list -c $COMPARTMENT_ID --all +echo "" + +# We can get a specific nat gateway +echo "Get nat gateway" +echo "=========================" +oci network nat-gateway get --nat-gateway-id $NAT_GATEWAY_ID +echo "" + +# We can update a nat gateway to block traffic through it +echo "Update nat gateway" +echo "=========================" +oci network nat-gateway update --nat-gateway-id $NAT_GATEWAY_ID --block-traffic true +echo "" + +# Now clean up resources. Since these resources have lifecycle states, we can use --wait-for-state so that the command +# In order to delete nat gateway, There must not be a route table that lists the NAT gateway as a target. +# only completes/returns when the resource has entered the DELETED (or equivalent) state +oci network route-table delete --rt-id $ROUTE_TABLE_ID --force --wait-for-state TERMINATED +echo "Deleted Route Table" + +oci network nat-gateway delete --nat-gateway-id $NAT_GATEWAY_ID --force --wait-for-state TERMINATED +echo "Deleted Nat Gateway" + +oci network vcn delete --vcn-id $VCN_ID --force --wait-for-state TERMINATED +echo "Deleted VCN" +echo "" + +echo "Script Finished" diff --git a/scripts/install/install.py b/scripts/install/install.py index d3a4fdc54..4b64b22ca 100644 --- a/scripts/install/install.py +++ b/scripts/install/install.py @@ -372,7 +372,7 @@ def handle_path_and_tab_completion(completion_file_path, exec_filepath, exec_dir # powershell one-liner to append the exec_dir to the USER path permanently # makes the assumption that powershell is on the PATH already - command = "powershell -Command \"[Environment]::SetEnvironmentVariable(\\\"PATH\\\", \\\"{};\\\" + (Get-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Environment' -Name PATH).Path, \\\"User\\\")".format(exec_dir) + command = "powershell -Command \"[Environment]::SetEnvironmentVariable(\\\"PATH\\\", \\\"{};\\\" + (Get-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Environment' -Name PATH).Path, \\\"User\\\")".format(exec_dir) # noqa: W605 subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) print_status() print_status('** Close and re-open PowerShell to reload changes to your PATH **') diff --git a/src/oci_cli/cli_util.py b/src/oci_cli/cli_util.py index 461a6cdb6..3821d62aa 100644 --- a/src/oci_cli/cli_util.py +++ b/src/oci_cli/cli_util.py @@ -658,7 +658,7 @@ def make_dict_keys_camel_case(original_obj, parameter_name=None, complex_paramet param_type_to_pass = None if complex_type_definition: if complex_type_definition['class'].find("dict(") == 0: - param_type_to_pass = { + param_type_to_pass = { # noqa: W605 'module': complex_type_definition['module'], 'class': re.match('dict\(([^,]*), (.*)\)', complex_type_definition['class']).group(2) } @@ -667,13 +667,26 @@ def make_dict_keys_camel_case(original_obj, parameter_name=None, complex_paramet else: cls_type = MODULE_TO_TYPE_MAPPINGS[complex_type_definition['module']][complex_type_definition['class']] instance = cls_type() - for underscored_name, camelized_name in instance.attribute_map.items(): - if camelized_key == camelized_name: - param_type_to_pass = { - 'module': complex_type_definition['module'], - 'class': instance.swagger_types[underscored_name] - } - break + possible_instances = [instance] + + # if the declared input type has subtypes, the actual data passed in may be a subtype + # in this case we need to check which subtype the input data is, and try to camelize based on that subtype + # if we try to camelize exclusively based on the base type, we dont know how to treat fields that are only present + # on the subtype (for example, if a field that is only present on the subtype is a dict, we need to that so we can + # skip camelizing it) + possible_subtype_instance = get_possible_subtype_based_on_payload(cls_type, complex_type_definition['module'], original_obj) + if possible_subtype_instance: + possible_instances.append(possible_subtype_instance) + + # try to process this as either the base type or the subtype we found based on discriminator value + for instance in possible_instances: + for underscored_name, camelized_name in instance.attribute_map.items(): + if camelized_key == camelized_name: + param_type_to_pass = { + 'module': complex_type_definition['module'], + 'class': instance.swagger_types[underscored_name] + } + break if camelize_keys: new_dict[camelized_key] = make_dict_keys_camel_case(value, parameter_name=key, complex_parameter_type=param_type_to_pass) @@ -686,7 +699,7 @@ def make_dict_keys_camel_case(original_obj, parameter_name=None, complex_paramet new_list = [] list_type = None if complex_type_definition and complex_type_definition['class'].find('list[') == 0: - list_type = {'module': complex_type_definition['module'], 'class': re.match('list\[(.*)\]', complex_type_definition['class']).group(1)} + list_type = {'module': complex_type_definition['module'], 'class': re.match('list\[(.*)\]', complex_type_definition['class']).group(1)} # noqa: W605 for obj in original_obj: new_list.append(make_dict_keys_camel_case(obj, complex_parameter_type=list_type)) @@ -729,6 +742,16 @@ def get_complex_type_definition_for_key_camelization(parameter_name, ctx=None): return None +def get_possible_subtype_based_on_payload(declared_type, module, payload): + if hasattr(declared_type, 'get_subtype'): + # get_subtype method checks the discriminator field on the input object to determine which type it is + # it expects the keys to be camelized so thus we are passing in camelized_top_level_keys instead of just original_obj + camelized_top_level_keys = {string_utils.camelize(key): value for key, value in six.iteritems(payload)} + subtype_name_of_input_data = declared_type.get_subtype(camelized_top_level_keys) + subtype_of_input_data = getattr(getattr(getattr(oci, module), 'models'), subtype_name_of_input_data) + return subtype_of_input_data() + + def get_param(command, param_name): for param in command.params: if param.name == param_name: @@ -1629,7 +1652,7 @@ def stream_page(is_json, page_index, call_result, ctx, previous_page_has_data): # first page: [ {. . .}, {. . . # subsequent pages: }, {. . .}, {. . . # last page: }, {. . .}, {. . .} ] - json_page_matcher = re.compile("(^\s*\[)([\s\S]*?)(}\s*\]$)") + json_page_matcher = re.compile("(^\s*\[)([\s\S]*?)(}\s*\]$)") # noqa: W605 if is_json: if 'skip_deserialization' in ctx.obj: display_dictionary = {} @@ -1683,7 +1706,7 @@ def build_query_expression(ctx): click.echo('In bash or similar "NIX" based shells used in "NIX" environment, escaping can be done by' 'using double quotes inside single quotes.\ne.g. --query \'data[*]."display-name"\'', # noqa: E127 file=sys.stderr) - click.echo('If using PowerShell in Windows environment, escaping can be done by using double quotes' + click.echo('If using PowerShell in Windows environment, escaping can be done by using double quotes' # noqa: W605 'with double escape character \`.\ne.g. --query data[*].\`"display-name\`"', # noqa: E127 file=sys.stderr) raise diff --git a/src/oci_cli/extended/core_cli_extended.py b/src/oci_cli/extended/core_cli_extended.py index 31421dc49..bce3c327c 100644 --- a/src/oci_cli/extended/core_cli_extended.py +++ b/src/oci_cli/extended/core_cli_extended.py @@ -21,7 +21,7 @@ from ..aliasing import CommandGroupWithAlias from ..cli_util import option -INSTANCE_CONSOLE_CONNECTION_STRING_INTERMEDIATE_HOST_REGEX = "(instance-console\.[a-z0-9-]+\.(oraclecloud|oracleiaas)\.com)" +INSTANCE_CONSOLE_CONNECTION_STRING_INTERMEDIATE_HOST_REGEX = "(instance-console\.[a-z0-9-]+\.(oraclecloud|oracleiaas)\.com)" # noqa: W605 DEFAULT_LOCAL_VNC_PORT = 5900 DEFAULT_SSH_PROXY_PORT = 5905 diff --git a/src/oci_cli/json_skeleton_utils.py b/src/oci_cli/json_skeleton_utils.py index 6a5212fbc..7dfa28501 100644 --- a/src/oci_cli/json_skeleton_utils.py +++ b/src/oci_cli/json_skeleton_utils.py @@ -226,7 +226,7 @@ def translate_complex_param_to_example_object(complex_param_entry): # For lists we produce an example 2 element list containing objects of whatever the list type is if cls.startswith('list['): - sub_kls = re.match('list\[(.*)\]', cls).group(1) + sub_kls = re.match('list\[(.*)\]', cls).group(1) # noqa: W605 return [ translate_complex_param_to_example_object({'module': complex_param_entry['module'], 'class': sub_kls}), translate_complex_param_to_example_object({'module': complex_param_entry['module'], 'class': sub_kls}) @@ -243,8 +243,8 @@ def translate_complex_param_to_example_object(complex_param_entry): key_sub_kls = 'str' value_sub_kls = 'str' else: - key_sub_kls = re.match('dict\(([^,]*), (.*)\)', cls).group(1) - value_sub_kls = re.match('dict\(([^,]*), (.*)\)', cls).group(2) + key_sub_kls = re.match('dict\(([^,]*), (.*)\)', cls).group(1) # noqa: W605 + value_sub_kls = re.match('dict\(([^,]*), (.*)\)', cls).group(2) # noqa: W605 value = translate_complex_param_to_example_object({'module': complex_param_entry['module'], 'class': value_sub_kls}) return {PRIMITIVE_TYPES_TO_EXAMPLE_KEY_VALUES[key_sub_kls][0]: value, PRIMITIVE_TYPES_TO_EXAMPLE_KEY_VALUES[key_sub_kls][1]: value} diff --git a/src/oci_cli/scripts/database/dbaas.py b/src/oci_cli/scripts/database/dbaas.py index 092db42f7..49e3624de 100644 --- a/src/oci_cli/scripts/database/dbaas.py +++ b/src/oci_cli/scripts/database/dbaas.py @@ -233,7 +233,7 @@ def create_backup_from_onprem(ctx, config_file, profile, **kwargs): cursor.execute('select sum(bytes)/1024/1024 from ( select sum(bytes) bytes from v$datafile union select sum(bytes) bytes from v$tempfile)') for row in cursor: dataSize = math.ceil(row[0]) - cursor.execute("select sum(bytes)/1024/1024 from (select sum(bytes*members) bytes from v$log where group# in " + + cursor.execute("select sum(bytes)/1024/1024 from (select sum(bytes*members) bytes from v$log where group# in " + # noqa: W504 "(select group# from v$logfile where type='ONLINE') union select (BLOCK_SIZE*FILE_SIZE_BLKS) bytes from v$controlfile)") for row in cursor: redoSize = math.ceil(row[0]) @@ -392,12 +392,12 @@ def create_backup_from_onprem(ctx, config_file, profile, **kwargs): script.write("run {\n") for channel in range(rmanchannels): - script.write("allocate channel odbms" + str(channel) + " type sbt " + - "PARMS='SBT_LIBRARY=" + tmpdir + os.path.sep + libfile + "," + + script.write("allocate channel odbms" + str(channel) + " type sbt " + # noqa: W504 + "PARMS='SBT_LIBRARY=" + tmpdir + os.path.sep + libfile + "," + # noqa: W504 "SBT_PARMS=(OPC_PFILE=" + tmpdir + os.path.sep + "opc" + os.environ['ORACLE_SID'] + ".ora)';\n") - script.write("backup as compressed backupset database tag '" + rmanTag + "' " + - "format '" + rmanTag + "__%d_%I_%U_%T_%t' " + - "keep until time 'sysdate+29000' restore point '" + rmanTag + "';\n" + + script.write("backup as compressed backupset database tag '" + rmanTag + "' " + # noqa: W504 + "format '" + rmanTag + "__%d_%I_%U_%T_%t' " + # noqa: W504 + "keep until time 'sysdate+29000' restore point '" + rmanTag + "';\n" + # noqa: W504 "}\n") script.close() diff --git a/src/oci_cli/version.py b/src/oci_cli/version.py index 70c769953..5eb842ab6 100644 --- a/src/oci_cli/version.py +++ b/src/oci_cli/version.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. -__version__ = '2.4.35' +__version__ = '2.4.36' diff --git a/tests/output/inline-help/audit.txt b/tests/output/inline-help/audit.txt index a8de3fc2c..ecd70b707 100644 --- a/tests/output/inline-help/audit.txt +++ b/tests/output/inline-help/audit.txt @@ -1,4 +1,4 @@ -CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'audit' command in version 2.4.35 of the CLI. +CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'audit' command in version 2.4.36 of the CLI. This file is generated by running test_help.py, which dumps the output of --help for every command. ++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/tests/output/inline-help/bv.txt b/tests/output/inline-help/bv.txt index a6ad00109..5dc4a56b0 100644 --- a/tests/output/inline-help/bv.txt +++ b/tests/output/inline-help/bv.txt @@ -1,4 +1,4 @@ -CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'bv' command in version 2.4.35 of the CLI. +CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'bv' command in version 2.4.36 of the CLI. This file is generated by running test_help.py, which dumps the output of --help for every command. ++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/tests/output/inline-help/ce.txt b/tests/output/inline-help/ce.txt index addf9603b..892a27bd8 100644 --- a/tests/output/inline-help/ce.txt +++ b/tests/output/inline-help/ce.txt @@ -1,4 +1,4 @@ -CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'ce' command in version 2.4.35 of the CLI. +CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'ce' command in version 2.4.36 of the CLI. This file is generated by running test_help.py, which dumps the output of --help for every command. ++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/tests/output/inline-help/compute-management.txt b/tests/output/inline-help/compute-management.txt index 5be5a02a4..9c334cf75 100644 --- a/tests/output/inline-help/compute-management.txt +++ b/tests/output/inline-help/compute-management.txt @@ -1,4 +1,4 @@ -CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'compute-management' command in version 2.4.35 of the CLI. +CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'compute-management' command in version 2.4.36 of the CLI. This file is generated by running test_help.py, which dumps the output of --help for every command. ++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/tests/output/inline-help/compute.txt b/tests/output/inline-help/compute.txt index ae2ffdd59..83894f61b 100644 --- a/tests/output/inline-help/compute.txt +++ b/tests/output/inline-help/compute.txt @@ -1,4 +1,4 @@ -CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'compute' command in version 2.4.35 of the CLI. +CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'compute' command in version 2.4.36 of the CLI. This file is generated by running test_help.py, which dumps the output of --help for every command. ++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/tests/output/inline-help/db.txt b/tests/output/inline-help/db.txt index 93e4a1e07..6b9e25814 100644 --- a/tests/output/inline-help/db.txt +++ b/tests/output/inline-help/db.txt @@ -1,4 +1,4 @@ -CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'db' command in version 2.4.35 of the CLI. +CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'db' command in version 2.4.36 of the CLI. This file is generated by running test_help.py, which dumps the output of --help for every command. ++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/tests/output/inline-help/dns.txt b/tests/output/inline-help/dns.txt index 8db6a7c99..aa789c52f 100644 --- a/tests/output/inline-help/dns.txt +++ b/tests/output/inline-help/dns.txt @@ -1,4 +1,4 @@ -CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'dns' command in version 2.4.35 of the CLI. +CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'dns' command in version 2.4.36 of the CLI. This file is generated by running test_help.py, which dumps the output of --help for every command. ++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/tests/output/inline-help/email.txt b/tests/output/inline-help/email.txt index b368c9318..ad00402c9 100644 --- a/tests/output/inline-help/email.txt +++ b/tests/output/inline-help/email.txt @@ -1,4 +1,4 @@ -CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'email' command in version 2.4.35 of the CLI. +CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'email' command in version 2.4.36 of the CLI. This file is generated by running test_help.py, which dumps the output of --help for every command. ++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/tests/output/inline-help/fs.txt b/tests/output/inline-help/fs.txt index 5967b78fa..cf8d973c0 100644 --- a/tests/output/inline-help/fs.txt +++ b/tests/output/inline-help/fs.txt @@ -1,4 +1,4 @@ -CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'fs' command in version 2.4.35 of the CLI. +CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'fs' command in version 2.4.36 of the CLI. This file is generated by running test_help.py, which dumps the output of --help for every command. ++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/tests/output/inline-help/iam.txt b/tests/output/inline-help/iam.txt index 94b4ae65f..f31ab9196 100644 --- a/tests/output/inline-help/iam.txt +++ b/tests/output/inline-help/iam.txt @@ -1,4 +1,4 @@ -CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'iam' command in version 2.4.35 of the CLI. +CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'iam' command in version 2.4.36 of the CLI. This file is generated by running test_help.py, which dumps the output of --help for every command. ++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/tests/output/inline-help/kms.txt b/tests/output/inline-help/kms.txt index ebbf275f1..078639f06 100644 --- a/tests/output/inline-help/kms.txt +++ b/tests/output/inline-help/kms.txt @@ -1,4 +1,4 @@ -CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'kms' command in version 2.4.35 of the CLI. +CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'kms' command in version 2.4.36 of the CLI. This file is generated by running test_help.py, which dumps the output of --help for every command. ++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/tests/output/inline-help/lb.txt b/tests/output/inline-help/lb.txt index ea97a2a6a..c434ae42b 100644 --- a/tests/output/inline-help/lb.txt +++ b/tests/output/inline-help/lb.txt @@ -1,4 +1,4 @@ -CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'lb' command in version 2.4.35 of the CLI. +CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'lb' command in version 2.4.36 of the CLI. This file is generated by running test_help.py, which dumps the output of --help for every command. ++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/tests/output/inline-help/network.txt b/tests/output/inline-help/network.txt index cca8372f4..a433b537d 100644 --- a/tests/output/inline-help/network.txt +++ b/tests/output/inline-help/network.txt @@ -1,4 +1,4 @@ -CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'network' command in version 2.4.35 of the CLI. +CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'network' command in version 2.4.36 of the CLI. This file is generated by running test_help.py, which dumps the output of --help for every command. ++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/tests/output/inline-help/os.txt b/tests/output/inline-help/os.txt index 0ae85433e..6c0557cd5 100644 --- a/tests/output/inline-help/os.txt +++ b/tests/output/inline-help/os.txt @@ -1,4 +1,4 @@ -CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'os' command in version 2.4.35 of the CLI. +CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'os' command in version 2.4.36 of the CLI. This file is generated by running test_help.py, which dumps the output of --help for every command. ++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/tests/output/inline-help/search.txt b/tests/output/inline-help/search.txt index 61743fc7b..0ad6e8a33 100644 --- a/tests/output/inline-help/search.txt +++ b/tests/output/inline-help/search.txt @@ -1,4 +1,4 @@ -CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'search' command in version 2.4.35 of the CLI. +CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'search' command in version 2.4.36 of the CLI. This file is generated by running test_help.py, which dumps the output of --help for every command. ++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/tests/output/inline-help/setup.txt b/tests/output/inline-help/setup.txt index c5bf815f4..6eeaa7ce3 100644 --- a/tests/output/inline-help/setup.txt +++ b/tests/output/inline-help/setup.txt @@ -1,4 +1,4 @@ -CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'setup' command in version 2.4.35 of the CLI. +CLI command reference is now available at https://docs.cloud.oracle.com/iaas/tools/oci-cli/latest/oci_cli_docs/. This file contains all the help for the 'setup' command in version 2.4.36 of the CLI. This file is generated by running test_help.py, which dumps the output of --help for every command. ++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/tests/test_compute.py b/tests/test_compute.py index 85515d959..f154563d6 100644 --- a/tests/test_compute.py +++ b/tests/test_compute.py @@ -472,7 +472,7 @@ def subtest_instance_console_connections(self): self.assertEquals({}, instance_console_connection_details['data']['defined-tags']) self.assertIsNotNone(parsed_result['data']['lifecycle-state']) - private_key_file = 'C:\\Users\\oci\console.ppk' + private_key_file = 'C:\\Users\\oci\console.ppk' # noqa: W605 params = [ 'compute', 'instance-console-connection', 'get-plink-connection-string', '--instance-console-connection-id', instance_console_connection_details['data']['id'], diff --git a/tests/unit/test_cli_util.py b/tests/unit/test_cli_util.py index e42f39325..2f02b222d 100644 --- a/tests/unit/test_cli_util.py +++ b/tests/unit/test_cli_util.py @@ -2,6 +2,7 @@ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. import click +import oci import tempfile import unittest from oci_cli import cli_util @@ -131,3 +132,12 @@ def test_coalesce_param_with_explicit_default_value_for_file_type_param(self): # ensure that returned value is a file handle, not a string assert hasattr(value, 'read') + + def test_get_possible_subtype_based_on_payload(self): + payload = { + 'instanceType': 'compute', + 'instanceDetails': {} + } + + subtype = cli_util.get_possible_subtype_based_on_payload(oci.core.models.InstanceConfigurationInstanceDetails, 'core', payload) + assert subtype.__class__.__name__ == 'ComputeInstanceDetails'