Skip to content

Commit 21ba2f0

Browse files
karthik-k-kamathHamadaGabrIbrahimharshkumar-devKanvipasrichalealex262
committed
Releasing version 3.16.1
Co-authored-by: Hamada Ibrahim <[email protected]> Co-authored-by: Harsh Kumar <[email protected]> Co-authored-by: Kanvi Pasricha <[email protected]> Co-authored-by: Alex Le <[email protected]> Co-authored-by: Nupur Gupta <[email protected]> Co-authored-by: Mandy Tsai <[email protected]> Co-authored-by: Vishwas Bhat <[email protected]>
1 parent 6c05efc commit 21ba2f0

File tree

11 files changed

+396
-40
lines changed

11 files changed

+396
-40
lines changed

CHANGELOG.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,26 @@ 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.16.1 - 2022-09-13
10+
--------------------
11+
12+
Added
13+
~~~~~
14+
* Support for calling Oracle Cloud Infrastructure services in the Madrid region (``--region eu-madrid-1``)
15+
16+
* Data Science service
17+
18+
* Support for new optional parameter
19+
20+
* ``oci data-science model create-model-artifact --if-match``
21+
22+
* Support for new commands
23+
24+
* ``oci data-science model export-model-artifact``
25+
* ``oci data-science model export-model-artifact-artifact-export-details-object-storage``
26+
* ``oci data-science model import-model-artifact``
27+
* ``oci data-science model import-model-artifact-artifact-import-details-object-storage``
28+
929
3.16.0 - 2022-09-06
1030
--------------------
1131

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.81.0
17+
oci==2.82.0
1818
packaging==20.2
1919
pluggy==0.13.0
2020
py==1.10.0

services/data_science/src/oci_cli_data_science/generated/datascience_cli.py

Lines changed: 267 additions & 2 deletions
Large diffs are not rendered by default.

services/object_storage/tests/integ/test_object_storage.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -461,14 +461,22 @@ def test_create_replication_policy(vcr_fixture, runner, config_file, config_prof
461461
# bucket create
462462
result = invoke(runner, config_file, config_profile, ['bucket', 'create', '-ns', util.NAMESPACE, '--compartment-id', util.COMPARTMENT_ID, '--name', dest_bucket, '--public-access-type', 'ObjectRead'])
463463
validate_response(result)
464-
# create policy
465-
result = invoke(runner, config_file, config_profile, ['replication', 'create-replication-policy', '-ns', util.NAMESPACE, '--name', 'replication-test-policy', '-bn', source_bucket, '--destination-bucket', dest_bucket, '--destination-region', util.OS_REPLICATION_DESTINATION_REGION])
466-
validate_response(result)
467-
response = json.loads(result.output)
468-
replication_id = response['data']['id']
469-
# delete policy
470-
result = invoke(runner, config_file, config_profile, ['replication', 'delete-replication-policy', '-ns', util.NAMESPACE, '--replication-id', replication_id, '--bucket-name', source_bucket, '--force'])
471-
validate_response(result)
464+
465+
try:
466+
# create policy
467+
result = invoke(runner, config_file, config_profile, ['replication', 'create-replication-policy', '-ns', util.NAMESPACE, '--name', 'replication-test-policy', '-bn', source_bucket, '--destination-bucket', dest_bucket, '--destination-region', util.OS_REPLICATION_DESTINATION_REGION])
468+
validate_response(result)
469+
response = json.loads(result.output)
470+
replication_id = response['data']['id']
471+
# delete policy
472+
result = invoke(runner, config_file, config_profile, ['replication', 'delete-replication-policy', '-ns', util.NAMESPACE, '--replication-id', replication_id, '--bucket-name', source_bucket, '--force'])
473+
validate_response(result)
474+
except Exception as ex:
475+
result = invoke(runner, config_file, config_profile, ['bucket', 'delete', '-ns', util.NAMESPACE, '--name', source_bucket, '--force'])
476+
validate_response(result)
477+
result = invoke(runner, config_file, config_profile, ['bucket', 'delete', '-ns', util.NAMESPACE, '--name', dest_bucket, '--force'])
478+
validate_response(result)
479+
472480
# bucket delete
473481
result = invoke(runner, config_file, config_profile, ['bucket', 'delete', '-ns', util.NAMESPACE, '--name', source_bucket, '--force'])
474482
validate_response(result)

services/object_storage/tests/integ/test_object_storage_bulk_operations.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,15 @@ def customer_key(request):
165165

166166

167167
@util.skip_while_rerecording
168-
@pytest.mark.skip('object storage tests are failing. skipping for now')
169168
def test_normalize_object_name_path():
170-
assert '/this/is/a/path' == oci_cli_object_storage.objectstorage_cli_extended.normalize_object_name_path_for_object_storage('/this/is/a/path')
171-
assert '/this/is/a/path' == oci_cli_object_storage.objectstorage_cli_extended.normalize_object_name_path_for_object_storage('/this/is/a/path', '/')
172-
assert '/this/is/a/path' == oci_cli_object_storage.objectstorage_cli_extended.normalize_object_name_path_for_object_storage('\\this\\is\\a\\path', '\\')
173-
assert '/this/is/a/path' == oci_cli_object_storage.objectstorage_cli_extended.normalize_object_name_path_for_object_storage('\\this/is/a\\path', '\\')
169+
assert '/this/is/a/path' == oci_cli_object_storage.objectstorage_cli_extended.normalize_file_path_for_object_storage('/this/is/a/path')
170+
assert '/this/is/a/path' == oci_cli_object_storage.objectstorage_cli_extended.normalize_file_path_for_object_storage('/this/is/a/path', '/')
171+
assert '/this/is/a/path' == oci_cli_object_storage.objectstorage_cli_extended.normalize_file_path_for_object_storage('\\this\\is\\a\\path', '\\')
172+
assert '/this/is/a/path' == oci_cli_object_storage.objectstorage_cli_extended.normalize_file_path_for_object_storage('\\this/is/a\\path', '\\')
174173

175-
assert 'thisisapath' == oci_cli_object_storage.objectstorage_cli_extended.normalize_object_name_path_for_object_storage('thisisapath')
176-
assert 'thisisapath' == oci_cli_object_storage.objectstorage_cli_extended.normalize_object_name_path_for_object_storage('thisisapath', '/')
177-
assert 'thisisapath' == oci_cli_object_storage.objectstorage_cli_extended.normalize_object_name_path_for_object_storage('thisisapath', '\\')
174+
assert 'thisisapath' == oci_cli_object_storage.objectstorage_cli_extended.normalize_file_path_for_object_storage('thisisapath')
175+
assert 'thisisapath' == oci_cli_object_storage.objectstorage_cli_extended.normalize_file_path_for_object_storage('thisisapath', '/')
176+
assert 'thisisapath' == oci_cli_object_storage.objectstorage_cli_extended.normalize_file_path_for_object_storage('thisisapath', '\\')
178177

179178

180179
@util.skip_while_rerecording
@@ -186,8 +185,10 @@ def test_get_all_objects_in_bucket(vcr_fixture):
186185

187186
# Ensure that content matches
188187
for object_name in bulk_get_object_to_content:
189-
if object_name[0] == '/' or object_name[0] == '\\':
188+
if object_name[0] == '/':
190189
file_path = os.path.join(download_folder, object_name[1:])
190+
elif object_name[0:2] == '\\':
191+
file_path = os.path.join(download_folder, object_name[2:])
191192
else:
192193
file_path = os.path.join(download_folder, object_name)
193194

services/object_storage/tests/integ/test_object_storage_multipart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def temp_bucket(runner, config_file, config_profile, object_storage_client):
7979

8080
try:
8181
print("Deleting bucket")
82-
result = invoke(runner, config_file, config_profile, ['bucket', 'delete', '-ns', util.NAMESPACE, '--name', bucket_name, '--force'])
82+
result = invoke(runner, config_file, config_profile, ['bucket', 'delete', '-ns', util.NAMESPACE, '--name', bucket_name, '--force', '--empty'])
8383
validate_response(result)
8484
except Exception as error:
8585
util.print_latest_exception(error)

services/object_storage/tests/integ/test_object_storage_sync_download.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,8 +810,10 @@ def compare_file_content_to_local(file_content_map, path_to_test, files_in_scope
810810
if files_in_scope and object_name not in files_in_scope:
811811
continue
812812

813-
if object_name[0] == '/' or object_name[0] == '\\':
813+
if object_name[0] == '/':
814814
file_path = os.path.join(path_to_test, object_name[1:])
815+
elif object_name[0:2] == "\\":
816+
file_path = os.path.join(path_to_test, object_name[2:])
815817
else:
816818
file_path = os.path.join(path_to_test, object_name)
817819

@@ -832,7 +834,7 @@ def create_new_files_local(path, no_of_files_to_create, with_content=False, exte
832834
with open(new_file_path, 'w') as fh:
833835
if with_content:
834836
fh.write(bulk_operation.generate_random_string(bulk_operation.CONTENT_STRING_LENGTH))
835-
new_local_file_set.add(new_file_path)
837+
new_local_file_set.add(new_file_path.replace(os.sep, '/'))
836838
return new_local_file_set
837839

838840

@@ -851,6 +853,7 @@ def create_new_objects_remote(client, bucket_name, no_of_files_to_create, with_c
851853
object_name = 'new_obj_{}.{}'.format(i, extension)
852854
if prefix:
853855
object_name = os.path.join(prefix, object_name)
856+
object_name = object_name.replace(os.sep, '/')
854857
content = bulk_operation.generate_random_string(bulk_operation.CONTENT_STRING_LENGTH)
855858
client.put_object(util.NAMESPACE, bucket_name, object_name, content if with_content else '')
856859
new_remote_obj_set.add(object_name)

services/object_storage/tests/integ/test_object_storage_sync_upload.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def test_sync_src_include_dry_run(debug):
200200
sync_upload_bucket_name, '--src-dir', sync_upload_test_dir, '--include',
201201
file_name_to_sync, '--dry-run'], debug=debug)
202202
deleted_set, uploaded_set, skipped_set = parse_dry_run_result(result.output.strip().split('\n'))
203-
assert uploaded_set == {os.path.join(sync_upload_test_dir, file_name_to_sync)}
203+
assert uploaded_set == {(os.path.join(sync_upload_test_dir, file_name_to_sync)).replace(os.sep, '/')}
204204
assert deleted_set == set()
205205
assert skipped_set == set()
206206

@@ -463,7 +463,7 @@ def test_sync_src_with_delete_and_include(object_storage_client):
463463
'--include', '*.pdf', '--include', '*.doc'], debug=debug)
464464
parsed_result = util.parse_json_response_from_mixed_output(result.output)
465465
assert parsed_result['upload-failures'] == {}
466-
assert set(parsed_result['uploaded-objects']) == set([f[len(sync_upload_test_dir):].strip('/') for f in l_file_set_1.union(l_file_set_2)])
466+
assert set(parsed_result['uploaded-objects']) == set([(f[len(sync_upload_test_dir):].replace(os.sep, '/')).strip('/') for f in l_file_set_1.union(l_file_set_2)])
467467
assert parsed_result['skipped-objects'] == []
468468
assert set(parsed_result['deleted-objects']) == r_obj_set_1
469469

@@ -645,7 +645,7 @@ def test_sync_src_with_delete_include_and_prefix(object_storage_client, debug):
645645
debug=debug)
646646
parsed_result = util.parse_json_response_from_mixed_output(result.output)
647647
assert parsed_result['upload-failures'] == {}
648-
assert set(parsed_result['uploaded-objects']) == set([os.path.join(_prefix, f[len(sync_upload_test_dir):].strip('/')) for f in l_file_set_1.union(l_file_set_2)])
648+
assert set(parsed_result['uploaded-objects']) == set([(os.path.join(_prefix, f[len(sync_upload_test_dir):].replace(os.sep, '/').strip('/'))) for f in l_file_set_1.union(l_file_set_2)])
649649
assert parsed_result['skipped-objects'] == []
650650
assert set(parsed_result['deleted-objects']) == r_obj_set_1
651651
cleanup_files_from_local(l_file_set_1.union(l_file_set_2))
@@ -709,7 +709,7 @@ def test_sync_src_with_delete_exclude_and_prefix(object_storage_client, debug):
709709
debug=debug)
710710
parsed_result = util.parse_json_response_from_mixed_output(result.output)
711711
assert parsed_result['upload-failures'] == {}
712-
assert set(parsed_result['uploaded-objects']) == set([os.path.join(_prefix, o) for o in sync_local_object_content.keys()])
712+
assert set(parsed_result['uploaded-objects']) == set([(os.path.join(_prefix, o).replace(os.sep, '/')) for o in sync_local_object_content.keys()])
713713
assert parsed_result['skipped-objects'] == []
714714
assert set(parsed_result['deleted-objects']) == r_obj_set_2
715715
cleanup_files_from_local(l_file_set_1.union(l_file_set_2))
@@ -764,6 +764,8 @@ def test_sync_src_with_no_follow_symlinks_file(debug):
764764

765765
# create the symlink
766766
create_symlink(file_to_create_a_symlink_of, symlink_fp)
767+
symlink_fp = symlink_fp.replace(os.sep, '/')
768+
symlink_pref = symlink_pref.replace(os.sep, '/')
767769

768770
# validate the output from dry-run first
769771
result = bulk_operation.invoke(['os', 'object', 'sync', '--namespace', util.NAMESPACE, '--bucket-name',
@@ -798,6 +800,8 @@ def test_sync_src_with_no_follow_symlinks_dir(debug):
798800

799801
# create the symlink
800802
create_symlink(dir_to_create_a_symlink_of, symlink_fp, is_directory=True)
803+
symlink_fp = symlink_fp.replace(os.sep, '/')
804+
symlink_pref = symlink_pref.replace(os.sep, '/')
801805

802806
# validate the output from dry-run first
803807
result = bulk_operation.invoke(['os', 'object', 'sync', '--namespace', util.NAMESPACE, '--bucket-name',
@@ -831,7 +835,8 @@ def test_sync_src_with_follow_symlinks_file(object_storage_client, debug):
831835
symlink_fp = os.path.join(sync_upload_test_dir, symlink_pref)
832836

833837
create_symlink(file_to_create_a_symlink_of, symlink_fp)
834-
838+
symlink_fp = symlink_fp.replace(os.sep, '/')
839+
symlink_pref = symlink_pref.replace(os.sep, '/')
835840
# validate the output from dry-run first
836841
result = bulk_operation.invoke(['os', 'object', 'sync', '--namespace', util.NAMESPACE, '--bucket-name',
837842
sync_upload_bucket_name, '--src-dir', sync_upload_test_dir,
@@ -870,6 +875,9 @@ def test_sync_src_with_follow_symlinks_dir(object_storage_client, debug):
870875

871876
# create the symlink
872877
create_symlink(dir_to_create_a_symlink_of, symlink_fp, is_directory=True)
878+
symlink_fp = symlink_fp.replace(os.sep, '/')
879+
symlink_pref = symlink_pref.replace(os.sep, '/')
880+
dir_to_create_a_symlink_of = dir_to_create_a_symlink_of.replace(os.sep, '/')
873881

874882
# validate the output from dry-run first
875883
result = bulk_operation.invoke(['os', 'object', 'sync', '--namespace', util.NAMESPACE, '--bucket-name',
@@ -895,7 +903,7 @@ def test_sync_src_with_follow_symlinks_dir(object_storage_client, debug):
895903
assert o[len(symlink_pref):].strip('/') in dir_content_with_symlink
896904
assert parsed_result['skipped-objects'] == []
897905
compare_file_content_to_remote(object_storage_client,
898-
{os.path.join(symlink_pref, k): v for k, v in dir_content_with_symlink.items()},
906+
{(os.path.join(symlink_pref, k)).replace(os.sep, '/'): v for k, v in dir_content_with_symlink.items()},
899907
prefix_to_test=symlink_pref)
900908
os.unlink(symlink_fp)
901909

@@ -926,10 +934,10 @@ def create_symlink(src_path_abs, symlink_fp, is_directory=False):
926934
# If the path doesn't match the link would be broken
927935
os.symlink(
928936
os.path.relpath(
929-
src_path_abs,
937+
src_path_abs.replace('/', os.sep),
930938
os.path.dirname(symlink_fp)
931-
),
932-
symlink_fp,
939+
).replace('/', os.sep),
940+
symlink_fp.replace('/', os.sep),
933941
target_is_directory=is_directory)
934942

935943

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.81.0',
32+
'oci==2.82.0',
3333
'arrow>=1.0.0',
3434
'certifi',
3535
'click==7.1.2',

src/oci_cli/cli_root.py

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,61 @@
4444

4545
OCI_CLI_AUTH_CHOICES = [cli_constants.OCI_CLI_AUTH_API_KEY, cli_constants.OCI_CLI_AUTH_INSTANCE_PRINCIPAL, cli_constants.OCI_CLI_AUTH_SESSION_TOKEN, cli_constants.OCI_CLI_AUTH_INSTANCE_OBO_USER, cli_constants.OCI_CLI_AUTH_RESOURCE_PRINCIPAL]
4646

47+
GENERATE_PARAM_JSON_HELP = """Complex input, such as arrays and objects, are passed in JSON format.
48+
49+
When passed the name of an option which takes complex input, this will print out example JSON of what needs to be passed to that option.
50+
Example::
51+
oci compute instance launch --generate_param_json_input_r agent-config > example.json
52+
53+
cat example.json
54+
Output::
55+
56+
{
57+
"areAllPluginsDisabled": true,
58+
"isManagementDisabled": true,
59+
"isMonitoringDisabled": true,
60+
"pluginsConfig": [
61+
{
62+
"desiredState": "string",
63+
"name": "string"
64+
},
65+
{
66+
"desiredState": "string",
67+
"name": "string"
68+
}
69+
]
70+
}
71+
72+
Edit the example.json file with correct values and use it as below ::
73+
74+
oci compute instance launch --agent-config file://example.json
75+
76+
"""
77+
GENERATE_FULL_COMMAND_JSON_HELP = """Prints out a JSON document which represents all possible options that can be provided to this command.
78+
79+
This JSON document can be saved to a file, modified with the appropriate option values, and then passed back via the --from-json option. This provides an alternative to typing options out on the command line.
80+
Example::
81+
oci os bucket get --generate_full_command_json_input_r > example.json
82+
cat example.json
83+
Output::
84+
85+
{
86+
"bucketName": "string",
87+
"fields": [
88+
"approximateCount|approximateSize|autoTiering"
89+
],
90+
"ifMatch": "string",
91+
"ifNoneMatch": "string",
92+
"name": "string",
93+
"namespace": "string",
94+
"namespaceName": "string"
95+
}
96+
97+
Edit the example.json file with correct values and use it as below ::
98+
99+
oci os bucket get --from-json file://example.json
100+
"""
101+
47102

48103
def eager_load_cli_rc_file(ctx, param, value):
49104
expanded_rc_default_location = os.path.expandvars(os.path.expanduser(cli_constants.CLI_RC_DEFAULT_LOCATION))
@@ -326,12 +381,8 @@ def find_latest_release_version(ctx, param, value):
326381
@click.option('--raw-output', is_flag=True, help='If the output of a given query is a single string value, this will return the string without surrounding quotes')
327382
@click.option('--auth', type=click.Choice(choices=OCI_CLI_AUTH_CHOICES), help='The type of auth to use for the API request. By default the API key in your config file will be used. This value can also be provided in the {auth_env_var} environment variable.'.format(auth_env_var=cli_constants.OCI_CLI_AUTH_ENV_VAR))
328383
@click.option('--auth-purpose', help='The The auth purpose which can be used in conjunction with --auth.')
329-
@click.option('--generate-full-command-json-input', is_flag=True, is_eager=True, help="""Prints out a JSON document which represents all possible options that can be provided to this command.
330-
331-
This JSON document can be saved to a file, modified with the appropriate option values, and then passed back via the --from-json option. This provides an alternative to typing options out on the command line.""")
332-
@click.option('--generate-param-json-input', is_eager=True, help="""Complex input, such as arrays and objects, are passed in JSON format.
333-
334-
When passed the name of an option which takes complex input, this will print out example JSON of what needs to be passed to that option.""")
384+
@click.option('--generate-full-command-json-input', is_flag=True, is_eager=True, help=GENERATE_FULL_COMMAND_JSON_HELP)
385+
@click.option('--generate-param-json-input', is_eager=True, help=GENERATE_PARAM_JSON_HELP)
335386
@click.option('--no-retry', is_flag=True, help='Disable retry logic for calls to services.')
336387
@click.option('--max-retries', type=click.INT, help='Maximum number of retry calls to be made to the service. For most commands, 5 attempts will be made. For operations with binary bodies, retries are disabled')
337388
@click.option('-d', '--debug', is_flag=True, help='Show additional debug information.')

0 commit comments

Comments
 (0)