Skip to content

Commit

Permalink
Releasing version 3.29.1
Browse files Browse the repository at this point in the history
Releasing version 3.29.1
  • Loading branch information
lealex262 committed Jun 20, 2023
2 parents 9a09783 + cd8d2bc commit cadff33
Show file tree
Hide file tree
Showing 28 changed files with 2,242 additions and 206 deletions.
68 changes: 68 additions & 0 deletions CHANGELOG.rst
Expand Up @@ -5,6 +5,74 @@ Change Log
All notable changes to this project will be documented in this file.

The format is based on `Keep a Changelog <http://keepachangelog.com/>`__.
3.29.1 - 2023-06-20
--------------------
Added
~~~~~

* Support for the Serial Console Access in the Database service

* ``oci db console-connection create``
* ``oci db console-connection delete``
* ``oci db console-connection update``
* ``oci db node update``

* Database Migration Service

* Support for creating a new connection with Network Security Group (NSG) Id's

* ``oci database-migration connection create --nsg-ids``

* Support for updating a connection with new Network Security Group (NSG) Id's

* ``oci database-migration connection update --nsg-ids``

* Support for new optional parameter in the Functions service

* ``oci fn application create --shape``

* Data Flow service

* Support for creating and managing Data Flow Pools

* ``oci data-flow pool``

* Support for additional optional parameters for using Data Flow pools

* ``oci data-flow application create --pool-id``
* ``oci data-flow application update --pool-id``
* ``oci data-flow run create --pool-id``
* ``oci data-flow run submit --pool-id``
* ``oci data-flow run list --pool-id``

* Rover Node Service

* Support for the following in the Roving Edge Infrastructure Service

* ``oci rover node create --cert-compartment-id --cert-key-algorithm --cert-signature-algorithm --common-name --issuer-certificate-authority-id --time-cert-validity-end``
* ``oci rover node update --cert-compartment-id --cert-key-algorithm --cert-signature-algorithm --certificate-authority-id --common-name --time-cert-validity-end``

* Commands for rover upgrade bundle support

* ``oci rover node rover-bundle copy-to-customer``
* ``oci rover node rover-bundle get-status``
* ``oci rover node rover-bundle-request list``
* ``oci rover node rover-bundle-version get``

* Commands for rover node certificate support

* ``oci rover node ca-bundle get``
* ``oci rover node certificate create``
* ``oci rover node certificate update``
* ``oci rover node certificate get-leaf-certificate``
* ``oci rover node certificate-authority update-root-ca``

* Commands for rover upgrade bundle support

* ``oci rover standalone-cluster rover-bundle copy-to-customer``
* ``oci rover standalone-cluster rover-bundle get-status``
* ``oci rover standalone-cluster rover-bundle-request list``
* ``oci rover standalone-cluster rover-bundle-version get``

3.29.0 - 2023-06-13
--------------------
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -14,7 +14,7 @@ Jinja2==3.0.3
jmespath==0.10.0
ndg-httpsclient==0.4.2
mock==2.0.0
oci==2.104.2
oci==2.104.3
packaging==20.2
pluggy==0.13.0
py==1.10.0
Expand Down
69 changes: 69 additions & 0 deletions scripts/examples/project_o/_o
@@ -0,0 +1,69 @@
# Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
# 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.

UPDATED="2021-04-26"

# This supports bash and zsh autocomplete for the o command.
# The same autocomplete works for "oci" as well.
#
# It uses the o's oci_commands file to get a list of commands, subcommands
# and parameters. Completion options are found by
# perl-ing oci_commands, which makes it really FAST and effective.
#
# REQUIRES: $HOME/.oci/oci_commands file, a text file listing
# of oci commands and parameters (courtesy of Project o)
OCI_COMMANDS=$HOME/.oci/oci_commands
[ ! -e $OCI_COMMANDS ] && OCI_COMMANDS=`which oci`_commands

# zsh setup for MacOS
# autoload -U +X bashcompinit && bashcompinit
# autoload -U +X compinit && compinit

# zsh setup for Linux
# autoload bashcompinit
# bashcompinit

# call function _o_completion for o or oci when [tab] is pressed
complete -F _o_completion o
complete -F _o_completion oci

# log useful for debugging; otherwise it's hard to see what's going on
pdate() { echo -e "import datetime as dt\nprint(dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3])"| python; }
log() { echo $(pdate) $@ >> log.txt ;}

# This function called on [tab] press
_o_completion() {
export word="${COMP_WORDS[COMP_CWORD]}" # possible incomplete last word
IN="${COMP_WORDS[@]}"
IN=${IN/#o/oci}
IN=${IN/#ocici/oci}
# log A .${IN}. word .${word}.
export IN
if [ "${IN}" = "${IN%% -*}" ]
then
if [ "$word" != "" ]; then
clist=$(perl -e 'my %c; if ($ENV{IN} =~ /(.*) (.*)/) { ($p1,$p2)=($1,$2) } # noqa: E999
while (<>) { $c{$1}=1 if /^$p1 ($p2\S*) /;}
$,="\n"; print sort keys %c;' $OCI_COMMANDS)
# log B $clist
else
IN="${IN%% } "
clist=$(perl -e 'my %c; while (<>) { $c{$1}=1 if /^$ENV{IN}([^-]\S+) /;}
$,="\n"; print sort keys %c;' $OCI_COMMANDS)
# log C $clist
[ "$clist" = "" ] && clist=$(grep "$IN" $OCI_COMMANDS |
perl -pe 's/.*? -/-/; s/\+ //; s/ [^-]\S+//g; @c{split /\s+/}=(); $,="\n"; print sort keys %c')
# log D $clist
fi
COMPREPLY=($(compgen -W "$clist" -- "$word"));
else
clist=$(grep "${IN%% -*}" $OCI_COMMANDS |
perl -ne 's/.*? -/-/; s/\+ //; s/ [^-]\S+//g; @c{split /\s+/}=(); $,="\n"; print sort keys %c')
# log E $clist
for i in ${COMP_WORDS[@]}; do # remove already used params from list
[ "${i%%-*}" = "" ] && [ "$i" != "$word" ] && clist=${clist/$i/}
done
COMPREPLY=($(compgen -W "$clist" -- "$word"));
fi
# log R ${COMPREPLY[@]}
}
98 changes: 56 additions & 42 deletions scripts/examples/project_o/o
Expand Up @@ -21,8 +21,8 @@ if (sys.platform != "win32"):
import fcntl
import errno
import datetime
VERSION = "1.7"
UPDATED = "2023-05-02"
VERSION = "1.8"
UPDATED = "2023-06-12"

# ==============================================================================
# Global variables
Expand Down Expand Up @@ -57,7 +57,6 @@ default_out_spec = 'name{:.30}#shape#cidr-block#prohibit-public{:5.5}' \
'#token'

matches = [] # list of commands that match user input
best_match = None # matches[best_match] is the closest match
all_options_for_this_cmd = '' # for best_match
remaining_options = '' # for best_match
options_out = [] # list of expanded options to be passed to oci cli
Expand Down Expand Up @@ -91,11 +90,13 @@ def usage(s=''):
<oci-options> Options and parameters for <oci-command>
These will be expanded into a more correct oci command
. or go Run the oci command if the line ends with "." (or "go")""")
. or go If the line ends with "." (or "go") run the oci command
! If line ends with "!", force-run the command, even if
param substitution fails""")

if s != "help":
print("""
o help More "o" options. Use "--help ." to get oci help""")
o help More "o" options and usage.""")
else:
print("""
More output options:
Expand All @@ -122,7 +123,15 @@ def usage(s=''):
o prune "name" Remove OCIDs for resources matching "name" from
$HOME/.oci/ocids. If "name" is a compartment, remove
all OCIDS under compartment "name".""")
all OCIDS under compartment "name".
touch $HOME/.oci/.otmp Activate "save last result" feature. With this
you can reformat output from the last command
without re-running the command with:
o -o <fmt>
o <oci-command> help Show all parameters, including globals
o <oci-command> --help . Get help from oci""")
print("""
o Version {} - {}
""".format(VERSION, UPDATED))
Expand Down Expand Up @@ -271,10 +280,9 @@ def setup_ocids_file():
and I'll do this for you:
o iam compartment get -c <tenancy-ocid> go
o iam ad list -c <tenancy-ocid> go
o iam region list go
o iam compartment list -c <tenancy-ocid> -ciis true -all go
o iam compartment list -c <tenancy-ocid> -ciis true -all .
o iam ad list -c <tenancy-ocid> .
o iam region-subscription list .
""")

# To be extra helpful, get likely tenancy ocid from oci config file
Expand All @@ -293,23 +301,30 @@ and I'll do this for you:
if len(sys.argv) == 3:
print("Tenancy name:", sys.argv[2])
print(bold('Setting up your ' + ocids_file_name + ' file:'))
if run_command(sys.argv[0] + ' -o name iam compartment get -c ' + sys.argv[1] + ' go'):
print(bold('\nGetting compartment names and ocids...'), end='')
if run_command(sys.argv[0] + ' -o name iam compartment list -c ' + sys.argv[1] + ' -ciis true -all .'):
print('\nThat didn\'t work. Your account may need additional privileges.')
exit(0)
print(bold('\nGetting availability domains...'), end='')
run_command(sys.argv[0] + ' -o name iam ad list -c ' + sys.argv[1] + ' .')
print(bold('\nGetting regions...'), end='')
run_command(sys.argv[0] + ' -o name iam region-subscription list .')
print(bold('\nGetting tenancy name from root compartment...'), end='')
if run_command(sys.argv[0] + ' -o name iam compartment get -c ' + sys.argv[1] + ' .'):
# compartment get on tenancy failed; try saving a stub for tenancy
print("\nThat didn't work. Creating a stub for tenancy root.")
print("\nCould not get root compartment.")
tenancy_name = input(bold("Enter tenancy name: "))
if not tenancy_name:
tenancy_name = 'root'
newids = {'root': {
'type': 'tenancy',
'alias': 'root' if len(sys.argv) == 2
else sys.argv[2],
'alias': tenancy_name,
'id': sys.argv[1],
'name': 'root' if len(sys.argv) == 2 else sys.argv[2]
'name': tenancy_name,
},
}
ocids_file('write', newids)
exit(0)
run_command(sys.argv[0] + ' -o name iam ad list -c ' + sys.argv[1] + ' go')
run_command(sys.argv[0] + ' -o name iam region list go')
run_command(sys.argv[0] + ' -o name iam compartment list -c '
+ sys.argv[1] + ' -ciis true -all go')
print('\n' + bold('All set. Have fun!\n'))

exit(0)
Expand Down Expand Up @@ -342,7 +357,7 @@ def ocids_file(action, new_ocids={}):
# Run setup if no ocids_file exists or
# if this is an "o <tenancy>" setup command and new_ocids is empty
if (not new_ocids
and (not re.search('get.*-c ocid..tenancy', ' '.join(sys.argv))
and (not (re.search('iam compartment list .*-c ocid..tenancy', ' '.join(sys.argv)))
and (not os.path.exists(ocids_file_name)
or re.search('o [^c]*ocid..tenancy', ' '.join(sys.argv))))):
setup_ocids_file()
Expand Down Expand Up @@ -570,10 +585,8 @@ def args_match_command(c, params):
# accept plurals in place of singulars
if (len(a) > 3 and a[-1] == 's' and a not in ['address', 'access', 'waas']):
a = a[:-1]

# stop searching at first -opt
if (len(a) and a[0] == '-'):
return (True)
if a[-2:] == 'ie':
a = a[:-2]

# Look for full-word match first
if ' ' + a + ' ' in action:
Expand All @@ -584,7 +597,7 @@ def args_match_command(c, params):
# look for word starting with arg
if ' ' + a in action or '-' + a in action:
# Scratch out this match
action = re.sub(' ' + a + r'\S+', ' ', action, count=1)
action = re.sub(' ' + r'(\S+-)*' + a + r'(\S+)', ' ', action, count=1)
continue

# look for rlc -> really-long-command
Expand Down Expand Up @@ -1163,7 +1176,7 @@ def jdump_item(item, indent=2):
re.sub(r'(?m)^[\s{}[\],]+\n', '', # noqa: E128
# noqa: E128 change key: [ value ] -> key: value
re.sub(r': \[\s+("[^"]*")\s+]', r': \1', # noqa: E128
json.dumps(item, indent=indent))))))) # noqa: E128
json.dumps(item, indent=indent, ensure_ascii=False))))))) # noqa: E128

# ==============================================================================

Expand Down Expand Up @@ -1212,7 +1225,7 @@ def show_item(item, fields, sep):
else:
out.append(value)
else:
if field == 'id' and sep == '|' and user_out_spec == default_out_spec:
if field == 'id' and sep == '|' and user_out_spec == default_out_spec and 'ocid' in value:
out.append(' ' + value.split('.')[3])
out.append(column[field]['format'].format(re.sub(r'[{}\'[\]\n]', '', value)[
column[field]['offset']:]))
Expand Down Expand Up @@ -1959,20 +1972,19 @@ elif 'help' == CLI_params[-1]:
# ==============================================================================
# Identify matching oci cli command(s)
# ==============================================================================
options_in_args = any(len(i) > 0 and '-' in i[0] for i in CLI_params)
command_words = [i for i, w in enumerate(CLI_params) if w.startswith('-')]
ncw = command_words[0] if command_words else len(CLI_params)
options_in_args = len(command_words) > 0

# Prioritize core services above others. The list could include: os, fs, bv
# But these already have priority due to their short service names.
# Each service name must end with ' '.
priority_services = ('compute ', 'bv ', 'os ', 'network ', 'iam ')
# Prioritize core services above others.
priority_services = ('compute ', 'bv ', 'os ', 'network ', 'iam ', 'db ')

# Find matching commands. Sort by priority, then by command length.
matches = sorted([c for c in command if args_match_command(c, CLI_params)],
matches = sorted([c for c in command if args_match_command(c, CLI_params[:ncw])],
key=lambda c: (len(c['action']) if len(c['action']) < 25 else int(round(len(c['action']) / 10.) * 10.))
if c['action'].startswith(priority_services)
else (1.5 * len(c['action']) if len(c['action']) < 25 else 1.5 * int(round(len(c['action']) / 10.) * 10.)),
reverse=True)
best_match = len(matches) - 1

# ==============================================================================
# Take action - either show help or 'go' run the command
Expand All @@ -1982,8 +1994,8 @@ if len(matches) == 0:
+ '\n\nTry: o .')

# If many matches, list matches and exit
elif not (len(matches) <= 16 or ('db' in CLI_params and len(matches) <= 50)
or matches[best_match]['action'].split(' ')[0] + ' ' in priority_services):
elif not (len(matches) <= 16
or (matches[-1]['action'].split(' ')[0] + ' ' in priority_services and len(matches) < 200 and ncw > 1)):
print(bold('Possible commands:'))
for c in matches:
show_command(c, prefix=' ')
Expand All @@ -1994,28 +2006,30 @@ elif not (len(matches) <= 16 or ('db' in CLI_params and len(matches) <= 50)
elif show_help:
for c in matches:
show_command(c, full=True)
print('use:', bold('o ' + c['action'] + ' --help go'), 'for full oci help')
print('For oci help:', bold('o ' + c['action'] + ' --help .\n')
+ 'https://docs.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/'
+ c['action'].replace(' ', '/') + '.html')
exit(0)

# Fewer than 16 matches. Didn't ask for help.
elif not go and quiet < 1:
if len(matches) > 1:
if options_in_args:
print(bold(str(len(matches)) + ' other matching commands not shown.'
print(bold(str(len(matches) - 1) + ' other matching commands not shown.'
+ ' (Remove parameters to see other commands.)'), end='')
else:
print(bold('Possible matches:'))
for i in range(len(matches)):
if i != best_match:
if i != len(matches) - 1:
show_command(matches[i], prefix=' ')
print(bold('\nBest match:'))
show_command(matches[best_match], full=True)
show_command(matches[-1], full=True)

# ==============================================================================
# We've settled on matching_command[best_match].
# We've settled on matches[-1] as the best match.
# Continue interpreting additional parameters (even if no 'go')
# ==============================================================================
c = matches[best_match]
c = matches[-1]
oci_command_line = 'oci ' + c['action'] + ' '

if c['action'] in ('audit event list', 'logging-search search-logs') and \
Expand Down

0 comments on commit cadff33

Please sign in to comment.