Skip to content

Commit f448266

Browse files
Kanvipasrichavish1HamadaGabrIbrahimharshkumar-devlealex262
committed
Releasing version 3.15.2
Co-authored-by: Vishwas Bhat <[email protected]> Co-authored-by: Hamada Ibrahim <[email protected]> Co-authored-by: Harsh Kumar <[email protected]> Co-authored-by: Alex Le <[email protected]> Co-authored-by: Nupur Gupta <[email protected]> Co-authored-by: Karthik Kamath <[email protected]>
1 parent 5945fa9 commit f448266

File tree

11 files changed

+532
-143
lines changed

11 files changed

+532
-143
lines changed

CHANGELOG.rst

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,41 @@ All notable changes to this project will be documented in this file.
66

77
The format is based on `Keep a Changelog <http://keepachangelog.com/>`__.
88

9+
3.15.2 - 2022-08-26
10+
--------------------
11+
12+
Added
13+
~~~~~
14+
* Support for dynamic window sizing and new terminal too small error message in interactive mode
15+
16+
* ``oci -i``
17+
18+
* Support for in-place upgrade in the OCVS service
19+
20+
* ``oci ocvs esxi-host create``
21+
22+
* Support for customers to choose to opt for Guest VM event collection, diagnostics logs and traces in the Database service
23+
24+
* ``oci db system launch``
25+
* ``oci db system launch-from-backup``
26+
* ``oci db system launch-from-database``
27+
* ``oci db system launch-from-db-system``
28+
* ``oci db system update``
29+
* ``oci db data-guard-association create with-new-db-system``
30+
31+
* Support for performance-based autotuning of Block and Boot Volumes in the Block Storage service
32+
33+
* ``oci bv boot-volume create``
34+
* ``oci bv boot-volume create-boot-volume-boot-volume-source-from-boot-volume-replica-details``
35+
* ``oci bv boot-volume update``
36+
* ``oci bv volume create``
37+
* ``oci bv volume create-volume-volume-source-from-block-volume-replica-details``
38+
* ``oci bv volume update``
39+
40+
* Support for Single Client Access Name protocol as Data Source and for Network Security Groups in Private Access Channel in the Analytics service
41+
42+
* ``oci analytics analytics-instance create-private-access-channel``
43+
944
3.15.1 - 2022-08-23
1045
--------------------
1146

@@ -45,7 +80,7 @@ Added
4580
* ``oci db maintenance-run update --target-db-server-version --target-storage-server-version``
4681

4782
Changed
48-
~~~~~
83+
~~~~~~~
4984
* Optimizer service
5085

5186
* The parameter --category-id is now optional in the below command

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Jinja2==3.0.3
1414
jmespath==0.10.0
1515
ndg-httpsclient==0.4.2
1616
mock==2.0.0
17-
oci==2.80.0
17+
oci==2.80.1
1818
packaging==20.2
1919
pluggy==0.13.0
2020
py==1.10.0

services/analytics/src/oci_cli_analytics/generated/analytics_cli.py

Lines changed: 54 additions & 18 deletions
Large diffs are not rendered by default.

services/core/src/oci_cli_blockstorage/generated/blockstorage_cli.py

Lines changed: 142 additions & 62 deletions
Large diffs are not rendered by default.

services/database/src/oci_cli_database/database_cli_extended.py

Lines changed: 116 additions & 6 deletions
Large diffs are not rendered by default.

services/database/src/oci_cli_database/generated/database_cli.py

Lines changed: 51 additions & 23 deletions
Large diffs are not rendered by default.

services/ocvp/src/oci_cli_esxi_host/generated/esxihost_cli.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ def esxi_host_summary_group():
5555
@cli_util.option('--current-sku', type=custom_types.CliCaseInsensitiveChoice(["HOUR", "MONTH", "ONE_YEAR", "THREE_YEARS"]), help=u"""The billing option currently used by the ESXi host. [ListSupportedSkus].""")
5656
@cli_util.option('--next-sku', type=custom_types.CliCaseInsensitiveChoice(["HOUR", "MONTH", "ONE_YEAR", "THREE_YEARS"]), help=u"""The billing option to switch to after the existing billing cycle ends. If `nextSku` is null or empty, `currentSku` continues to the next billing cycle. [ListSupportedSkus].""")
5757
@cli_util.option('--compute-availability-domain', help=u"""The availability domain to create the ESXi host in. If keep empty, for AD-specific SDDC, new ESXi host will be created in the same availability domain; for multi-AD SDDC, new ESXi host will be auto assigned to the next availability domain following evenly distribution strategy.""")
58-
@cli_util.option('--failed-esxi-host-id', help=u"""The [OCID] of the ESXi host that is failed. This is an optional parameter. If this parameter is specified, a new ESXi host will be created to replace the failed one, and the `failedEsxiHostId` field will be udpated in the newly created Esxi host.""")
58+
@cli_util.option('--failed-esxi-host-id', help=u"""The [OCID] of the ESXi host that is failed. This is an optional parameter. If this parameter is specified, a new ESXi host will be created to replace the failed one, and the `failedEsxiHostId` field will be updated in the newly created Esxi host.""")
5959
@cli_util.option('--host-shape-name', help=u"""The compute shape name of the ESXi host. [ListSupportedHostShapes].""")
6060
@cli_util.option('--host-ocpu-count', type=click.FLOAT, help=u"""The OCPU count of the ESXi host.""")
6161
@cli_util.option('--capacity-reservation-id', help=u"""The [OCID] of the Capacity Reservation.""")
62+
@cli_util.option('--non-upgraded-esxi-host-id', help=u"""The [OCID] of the ESXi host that will be upgraded. This is an optional parameter. If this parameter is specified, an ESXi host with new version will be created to replace the original one, and the `nonUpgradedEsxiHostId` field will be updated in the newly created Esxi host.""")
6263
@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
6364
6465
Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@@ -73,7 +74,7 @@ def esxi_host_summary_group():
7374
@click.pass_context
7475
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'ocvp', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'ocvp', 'class': 'dict(str, dict(str, object))'}})
7576
@cli_util.wrap_exceptions
76-
def create_esxi_host(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, sddc_id, display_name, current_sku, next_sku, compute_availability_domain, failed_esxi_host_id, host_shape_name, host_ocpu_count, capacity_reservation_id, freeform_tags, defined_tags):
77+
def create_esxi_host(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, sddc_id, display_name, current_sku, next_sku, compute_availability_domain, failed_esxi_host_id, host_shape_name, host_ocpu_count, capacity_reservation_id, non_upgraded_esxi_host_id, freeform_tags, defined_tags):
7778

7879
kwargs = {}
7980
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
@@ -105,6 +106,9 @@ def create_esxi_host(ctx, from_json, wait_for_state, max_wait_seconds, wait_inte
105106
if capacity_reservation_id is not None:
106107
_details['capacityReservationId'] = capacity_reservation_id
107108

109+
if non_upgraded_esxi_host_id is not None:
110+
_details['nonUpgradedEsxiHostId'] = non_upgraded_esxi_host_id
111+
108112
if freeform_tags is not None:
109113
_details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
110114

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def open_relative(*path):
2929
readme = f.read()
3030

3131
requires = [
32-
'oci==2.80.0',
32+
'oci==2.80.1',
3333
'arrow>=1.0.0',
3434
'certifi',
3535
'click==7.1.2',

src/interactive/cli_interactive.py

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,24 @@
33
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
44

55
from oci_cli import cli_util
6-
from prompt_toolkit import PromptSession
76
from prompt_toolkit.document import Document
87
from prompt_toolkit.completion import ThreadedCompleter
9-
from prompt_toolkit.styles import Style
10-
from interactive.oci_shell_completer import OciShellCompleter
118
from interactive.bottom_toolbar import BottomToolbar
9+
from interactive.oci_shell_completer import OciShellCompleter
1210
from interactive.utils import (
13-
styles_dict,
1411
AUTHENTICATION_PARAMS,
15-
DEBUG_PARAMS,
1612
AUTO_PROMPT_PARAMS,
13+
DEBUG_PARAMS,
1714
OCI_CLI_DISABLE_COLORS_ENV_VAR,
18-
INTERACTIVE_COMMANDS_HISTORY_FILE_NAME,
1915
)
2016

2117
from interactive.key_bindings import override_key_binding
22-
from interactive.commands_history import CommandsHistory
18+
from interactive.prompt_session import create_oci_prompt_session
2319
import os
2420
import sys
2521

2622

27-
def start_interactive_mode(ctx):
28-
29-
toolbar = BottomToolbar()
30-
cli_interactive_history = CommandsHistory(
31-
INTERACTIVE_COMMANDS_HISTORY_FILE_NAME
32-
)
23+
def start_interactive_shell(ctx):
3324

3425
# Getting the commands before --cli-auto-prompt, for example if the user execute oci --profile X compute instance --cli-auto-prompt,
3526
# then the interactive mode will begin with oci --profile X compute instance
@@ -57,30 +48,25 @@ def start_interactive_mode(ctx):
5748
endpoint = ctx.obj["endpoint"]
5849
ctx.obj["endpoint"] = None
5950

60-
colors_enabled = True
61-
if OCI_CLI_DISABLE_COLORS_ENV_VAR in os.environ:
62-
colors_enabled = False
63-
64-
style = Style.from_dict(styles_dict)
65-
cli_command = [("class:oci", "> oci ")]
66-
6751
# Initialize the document with the initial commands typed by the user
6852
document = Document(command_before_prompt, len(command_before_prompt))
6953
# Build the config before invoking the prompt session to raise any errors due to incorrect config
7054
cli_util.create_config_and_signer_based_on_click_context(ctx)
55+
56+
colors_enabled = True
57+
if OCI_CLI_DISABLE_COLORS_ENV_VAR in os.environ:
58+
colors_enabled = False
59+
60+
# Build Prompt
61+
toolbar = BottomToolbar()
62+
session = create_oci_prompt_session(colors_enabled, toolbar)
7163
completer = OciShellCompleter(ctx, colors_enabled, bottom_toolbar=toolbar)
7264
kb = override_key_binding(completer=completer, toolbar=toolbar)
7365
multithread_completer = ThreadedCompleter(
7466
completer
7567
) # This is needed for oci resources suggestion to not block the user until the result comes
76-
os.system("clear") # Start from the beginning of the terminal window to avoid "window too small" error
77-
session = PromptSession(
78-
message=cli_command,
79-
style=style if colors_enabled else None,
80-
complete_while_typing=True,
81-
bottom_toolbar=toolbar.show_toolbar,
82-
history=cli_interactive_history,
83-
)
68+
69+
# Get Command
8470
text = session.prompt(
8571
completer=multithread_completer, default=document, key_bindings=kb
8672
)
@@ -95,4 +81,6 @@ def start_interactive_mode(ctx):
9581
+ " "
9682
+ text if text else ""
9783
)
84+
85+
# Execute Command
9886
os.system(command)

src/interactive/prompt_session.py

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# coding: utf-8
2+
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
3+
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
4+
5+
from prompt_toolkit import PromptSession
6+
from prompt_toolkit.application import get_app
7+
from prompt_toolkit.styles import Style
8+
from prompt_toolkit.layout import Dimension, FormattedTextControl, Window
9+
from interactive.commands_history import CommandsHistory
10+
from interactive.error_messages import get_error_message
11+
12+
from interactive.utils import (
13+
styles_dict,
14+
INTERACTIVE_COMMANDS_HISTORY_FILE_NAME,
15+
)
16+
17+
18+
def create_oci_prompt_session(colors_enabled=True, bottom_toolbar=None):
19+
"""
20+
Setup resources and create Oci Prompt Session
21+
"""
22+
23+
# Setup History
24+
cli_interactive_history = CommandsHistory(
25+
INTERACTIVE_COMMANDS_HISTORY_FILE_NAME
26+
)
27+
28+
# Setup Style
29+
style = Style.from_dict(styles_dict)
30+
cli_command = [("class:oci", "> oci ")]
31+
32+
# Create Session
33+
session = OciPromptSession(
34+
message=cli_command,
35+
style=style if colors_enabled else None,
36+
complete_while_typing=True,
37+
dynamic_size=True, # Turn on dynamic sizing session
38+
min_space=4, # bottom toolbar uses 3 additional rows
39+
max_space=20, # Autocomplete menu does not show more than 16 items
40+
b_toolbar=bottom_toolbar,
41+
history=cli_interactive_history,
42+
)
43+
44+
return session
45+
46+
47+
class OciPromptSession(PromptSession):
48+
def __init__(
49+
self,
50+
b_toolbar=None,
51+
dynamic_size=False,
52+
min_space=0,
53+
max_space=0,
54+
*args,
55+
**kwargs
56+
):
57+
super().__init__(bottom_toolbar=b_toolbar.show_toolbar, *args, **kwargs)
58+
59+
# Setup Dynamic Sizing Window Variables
60+
# Set to 0 or False to turn off
61+
self.dynamic_size = dynamic_size
62+
self.min_space = max(min_space, 0)
63+
self.max_space = max(max_space, 0)
64+
65+
# Save Bottom Toolbar variables & functions
66+
if b_toolbar:
67+
self.bottom_toolbar_size = b_toolbar.size
68+
self.bottom_toolbar_msg = b_toolbar.set_toolbar_text
69+
self.reserve_space_for_menu = max(self.min_space - self.bottom_toolbar_size, 0)
70+
else:
71+
self.bottom_toolbar_size = 0
72+
self.bottom_toolbar_msg = None
73+
self.reserve_space_for_menu = self.min_space
74+
75+
# Update window too small error
76+
self.layout.container.window_too_small = Window(
77+
FormattedTextControl(
78+
text=[("class:window-too-small", get_error_message("terminal_too_small"))]
79+
)
80+
)
81+
82+
def _get_default_buffer_control_height(self) -> Dimension:
83+
"""
84+
Controls the Dimension height for prompt session and window_too_small error message handling
85+
"""
86+
# Run parent's checks
87+
dimension = super()._get_default_buffer_control_height()
88+
89+
# Compute largest possible window hieght
90+
height = get_app().output.get_size().rows - 1
91+
if not self.max_space:
92+
max_window_size = height
93+
else:
94+
max_window_size = min(self.max_space, height)
95+
max_window_size = max(max_window_size - self.bottom_toolbar_size, 0)
96+
97+
# Set Window Height
98+
if self.dynamic_size and self.completer.completer.size and dimension.min:
99+
dimension.min = min(self.completer.completer.size + 1, max_window_size)
100+
101+
# Window is too small for autocomplete menu to display
102+
if self.bottom_toolbar_msg and max_window_size <= 0:
103+
self.bottom_toolbar_msg(
104+
get_error_message("terminal_too_small"),
105+
is_error=True,
106+
)
107+
108+
return dimension

0 commit comments

Comments
 (0)