Skip to content

Commit 77577c7

Browse files
author
Oracle Public Cloud User
committed
Releasing version 2.2.0
1 parent 4c50eb6 commit 77577c7

File tree

395 files changed

+24137
-2823
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

395 files changed

+24137
-2823
lines changed

CHANGELOG.md

+20
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
55
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [2.2.0] - 2020-6-25
8+
9+
### Added:
10+
- Added Domain Name System (DNS) modules
11+
- Added Email modules
12+
- Added Marketplace modules
13+
- Added Monitoring modules
14+
- Added Notifications modules
15+
- Added Streaming modules
16+
- Added Functions modules
17+
- Added Database Data Guard modules
18+
- Added new modules for Compute and Network
19+
- Added subparameter `admission_controller_options` in the options parameter of module `oci_container_engine_cluster`
20+
- Added `node_source_details` parameter in the `oci_container_engine_node_pool module`
21+
22+
### Changed:
23+
- Please update to the latest version of OCI Python SDK.
24+
- `compartment_id` parameter removed from `oci_database_maintenance_run.py`
25+
- This parameter was optional and was unused by the module so is being removed
26+
727
## [2.1.2-Beta] - 2020-6-9
828

929
### Changed:

MigrationGuide.md

+24
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ No breaking changes
155155
|oci_database_facts | oci_database_database_facts | Module name is the only breaking change
156156
|oci_backup | oci_database_backup | Breaking changes: <ul><li>`id` alias has been removed from the `database_id` parameter, and added to the `backup_id` parameter</li></ul>
157157
|oci_backup_facts | oci_database_backup_facts | Breaking changes: <ul><li>`id` alias has been removed from the `database_id` parameter, and added to the `backup_id` parameter</li></ul>
158+
|oci_data_guard_association | oci_database_data_guard_association | Breaking changes: <ul><li>The following values for `state` have been removed: `failover`, `swichover`, `reinstate`. <ul><li>These actions should be performed using the `oci_database_data_guard_association_actions` module.</li><li>The `data_guard_association_id` parameter is also moved to the corresponding actions module.</li></ul></li></ul>
159+
|oci_data_guard_association_facts | oci_database_data_guard_association_facts | Module name is the only breaking change
158160
|oci_db_home | oci_database_db_home | Breaking changes: <ul><li>`compartment_id` parameter has been added and is required for creating a db_home</li></ul>
159161
|oci_db_home_facts | oci_database_db_home_facts | Module name is the only breaking change
160162
|oci_db_home_patch_facts | oci_database_db_home_patch_facts | Module name is the only breaking change
@@ -184,6 +186,15 @@ No breaking changes
184186
|oci_autonomous_exadata_infrastructure_facts | oci_database_autonomous_exadata_infrastructure_facts | Breaking changes due to service API change: <ul><li>`maintenance_window_details` option has additional suboptions available which are `preference`, `months` and `weeks_of_month` in returned values</li> <li>return values include the ocids `last_maintenance_run_id` and `next_maintenance_run_id` instead of `last_maintenance_run` and `next_maintenance_run`</li></ul>
185187
|oci_autonomous_exadata_infrastructure_shape_facts | oci_database_autonomous_exadata_infrastructure_shape_facts | Module name is the only breaking change
186188

189+
#### Email
190+
191+
|old name | new name | migration notes
192+
|-----------------------|-------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
193+
|oci_sender | oci_email_sender | Module name is the only breaking change
194+
|oci_sender_facts | oci_email_sender_facts | Module name is the only breaking change
195+
|oci_suppression | oci_email_suppression | Module name is the only breaking change
196+
|oci_suppression_facts | oci_email_suppression_facts | Module name is the only breaking change
197+
187198
#### File Storage
188199

189200
|old name | new name | migration notes
@@ -343,3 +354,16 @@ No breaking changes
343354
|oci_object_storage_object_lifecycle_policy_facts | oci_object_storage_object_lifecycle_policy_facts | Module name is the only breaking change
344355
|oci_preauthenticated_request | oci_object_storage_preauthenticated_request | Breaking changes: <ul><li>Creating a preauthetincated request in the new module is not idempotent.</li></ul>
345356
|oci_preauthenticated_request_facts | oci_object_storage_preauthenticated_request_facts | Module name is the only breaking change
357+
358+
#### DNS
359+
360+
|old name | new name | migration notes
361+
|-------------------------------------------------|-----------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------
362+
|oci_zone | oci_dns_zone | Breaking changes: <ul><li>Deleting a zone using `name` parameter is not supported in the new module when environment variable `OCI_USE_NAME_AS_IDENTIFIER` is not set. You can delete a zone using `zone_name_or_id` parameter or `name` parameter when `OCI_USE_NAME_AS_IDENTIFIER` is set in the new module.</li></ul>
363+
|oci_zone_facts | oci_dns_zone_facts | Module name is the only breaking change
364+
|oci_zone_records | oci_dns_zone_records | Module name is the only breaking change
365+
|oci_zone_records_facts | oci_dns_zone_records_facts | Module name is the only breaking change
366+
|oci_domain_records | oci_dns_domain_records | Module name is the only breaking change
367+
|oci_domain_records_facts | oci_dns_domain_records_facts | Module name is the only breaking change
368+
|oci_rrset | oci_dns_rrset | Module name is the only breaking change
369+
|oci_rrset_facts | oci_dns_rrset_facts | Module name is the only breaking change

README.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# Oracle Cloud Infrastructure Ansible Collection - Beta
2-
While we are in beta, you **must** specify the version while installing oracle.oci `ansible-galaxy collection install oracle.oci:<version>`. To install the latest version (2.1.2-beta), use the following command:
3-
> **ansible-galaxy collection install oracle.oci:2.1.2-beta**
4-
1+
# Oracle Cloud Infrastructure Ansible Collection
52

63
Oracle Cloud Infrastructure Ansible Collection provides an easy way to provision and manage resources in Oracle Cloud using Ansible.
74

@@ -38,6 +35,13 @@ We have also added a new [User Guide](https://github.com/oracle/oci-ansible-coll
3835
- Budget/Account management
3936
- Health Checks
4037
- Vault Secret and Key Management (KMS)
38+
- Domain Name System (DNS)
39+
- Email
40+
- Marketplace
41+
- Monitoring
42+
- Notifications
43+
- Streaming
44+
- Functions
4145

4246

4347
## Installation
@@ -46,7 +50,7 @@ We have also added a new [User Guide](https://github.com/oracle/oci-ansible-coll
4650

4751
You can install it from [Ansible Galaxy](https://galaxy.ansible.com/oracle) using the command:
4852
``` bash
49-
$ ansible-galaxy collection install oracle.oci:2.1.2-beta
53+
$ ansible-galaxy collection install oracle.oci
5054
```
5155
Notes:
5256
* Collections is supported in Ansible 2.9+.

UserGuide.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,7 @@ There would be no ambiguity and it would only ever match the 50 GB block volume.
6161

6262
It is important to note that matching these extra fields only comes into play if *all* other fields match *and* you did not specify optional values with defaults. Thus, this corner case can be avoided very easily by doing either of the following:
6363
- Use unique attributes or tags for resources of the same type so there is no potential for ambiguity in matching resources
64-
- Specify optional values that you care about instead of relying on server side defaults
64+
- Specify optional values that you care about instead of relying on server side defaults
65+
66+
### Support for `key_by` option
67+
All modules support the key_by option. It takes a list of comma-separated attributes of the resource which should be used to uniquely identify the resource. By default, all the attributes of a resource are used to uniquely identify a resource.

galaxy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace: oracle
99
name: oci
1010

1111
# The version of the collection. Must be compatible with semantic versioning
12-
version: 2.1.2-beta
12+
version: 2.2.0
1313

1414
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
1515
readme: README.md

plugins/doc_fragments/oracle_creatable_resource.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ModuleDocFragment(object):
2121
type: bool
2222
key_by:
2323
description: The list of comma-separated attributes of this resource which should be used to uniquely
24-
identify an instance of the resource. By default, all the attributes of a resource except
25-
I(freeform_tags) are used to uniquely identify a resource.
24+
identify an instance of the resource. By default, all the attributes of a resource are
25+
used to uniquely identify a resource.
2626
type: list
2727
"""

plugins/module_utils/oci_common_utils.py

+32-7
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@
5454
]
5555

5656
CANCELLED_STATES = ["CANCELLED"]
57+
FAILED_STATES = ["FAILED"]
5758

5859
WORK_REQUEST_COMPLETED_STATES = ["SUCCEEDED", "SUCCESS", "FAILED", "COMPLETED"]
5960
WORK_REQUEST_SUCCESS_STATES = ["SUCCEEDED", "SUCCESS"]
60-
WORK_REQUEST_FAILED_STATES = ["FAILED"]
61+
WORK_REQUEST_FAILED_STATES = FAILED_STATES
6162

6263
# If a resource is in one of these states, it would be considered deleted
6364
DEFAULT_TERMINATED_STATES = ["TERMINATED", "DETACHED", "DELETED"]
@@ -96,6 +97,7 @@
9697

9798
CREATE_OPERATION_KEY = "CREATE"
9899
UPDATE_OPERATION_KEY = "UPDATE"
100+
PATCH_OPERATION_KEY = "PATCH"
99101
DELETE_OPERATION_KEY = "DELETE"
100102
ACTION_OPERATION_KEY = "ACTION"
101103
ANY_OPERATION_KEY = "ANY"
@@ -199,7 +201,7 @@ def list_all_resources(target_fn, **kwargs):
199201
# compare_dicts is used to compare create and update model dicts with the existing resource. Since the existing
200202
# resource might have more parameters (for ex: OCID, time_created etc) than the information we provide during the
201203
# creation, we do a subset match of the dictionary.
202-
# But if a parameter present in create/update model and not in existing resource, it is considered a mismatch by default
204+
# But if a parameter present in the create/update model and not in existing resource, it is considered a mismatch by default
203205
# This behaviour can be changed by setting the flag `ignore_attr_if_not_in_target`.
204206
def compare_dicts(
205207
source_dict, target_dict, attrs=None, ignore_attr_if_not_in_target=False
@@ -284,7 +286,7 @@ def compare_dicts(
284286
return True
285287

286288

287-
def compare_lists(source_list, target_list):
289+
def compare_lists(source_list, target_list, ignore_attr_if_not_in_target=False):
288290
if source_list is None or target_list is None:
289291
_debug(
290292
"list is not subset because source list: {source_list} or target list: {target_list} is None".format(
@@ -308,7 +310,16 @@ def compare_lists(source_list, target_list):
308310
)
309311
return False
310312

311-
if all([is_in_list(target_list, element) for element in source_list]):
313+
if all(
314+
[
315+
is_in_list(
316+
target_list,
317+
element,
318+
ignore_attr_if_not_in_target=ignore_attr_if_not_in_target,
319+
)
320+
for element in source_list
321+
]
322+
):
312323
return True
313324

314325
_debug(
@@ -317,15 +328,29 @@ def compare_lists(source_list, target_list):
317328
return False
318329

319330

320-
def is_in_list(target_list, element):
331+
def is_in_list(target_list, element, ignore_attr_if_not_in_target=False):
321332
if isinstance(element, dict):
322333
if any(
323-
[compare_dicts(element, target_element) for target_element in target_list]
334+
[
335+
compare_dicts(
336+
element,
337+
target_element,
338+
ignore_attr_if_not_in_target=ignore_attr_if_not_in_target,
339+
)
340+
for target_element in target_list
341+
]
324342
):
325343
return True
326344
elif isinstance(element, list):
327345
if any(
328-
[compare_lists(element, target_element) for target_element in target_list]
346+
[
347+
compare_lists(
348+
element,
349+
target_element,
350+
ignore_attr_if_not_in_target=ignore_attr_if_not_in_target,
351+
)
352+
for target_element in target_list
353+
]
329354
):
330355
return True
331356
else:

plugins/module_utils/oci_compute_custom_helpers.py

+22-15
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
try:
1818
from oci.core import VirtualNetworkClient
1919
from oci.util import to_dict
20-
from oci.core.models import ImageShapeCompatibilityEntry
2120
from oci.exceptions import ServiceError
2221

2322
HAS_OCI_PY_SDK = True
@@ -249,23 +248,31 @@ def get_exclude_attributes(self):
249248

250249

251250
class ImageShapeCompatibilityEntryHelperCustom:
252-
def get_resource(self):
253-
# This resource does not have a get or list method. `update` and `delete` does not return anything and
254-
# updating even if the entry exists does not throw any error. Same with delete. So choosing to make the API
255-
# call always. The customisation for `get_resource` is only to make the other functions work and to return
256-
# some data to the user.
257-
return oci_common_utils.get_default_response_from_resource(
258-
resource=oci_common_utils.convert_input_data_to_model_class(
259-
self.module.params, ImageShapeCompatibilityEntry
260-
)
261-
)
251+
def is_update(self):
252+
if not self.module.params.get("state") == "present":
253+
return False
262254

263-
def is_update_necessary(self):
264-
# This resource does not have a get or list method. So no way to check if it already exists or not. So always
265-
# update. Also making the API call even if the entry exists does not throw any error. So choosing to make
266-
# the API call always.
267255
return True
268256

257+
def get_existing_resource_dict_for_update(self):
258+
try:
259+
get_response = self.get_resource()
260+
except ServiceError as se:
261+
if se.status != 404:
262+
raise
263+
return dict()
264+
else:
265+
return to_dict(get_response.data)
266+
267+
def is_update_necessary(self, existing_resource_dict):
268+
269+
if not existing_resource_dict:
270+
return True
271+
272+
return super(
273+
ImageShapeCompatibilityEntryHelperCustom, self
274+
).is_update_necessary(existing_resource_dict)
275+
269276

270277
class VnicAttachmentHelperCustom:
271278
def get_create_model_dict_for_idempotence_check(self, create_model):

plugins/module_utils/oci_compute_management_custom_helpers.py

-36
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,6 @@ def __init__(self, *args, **kwargs):
4646
self.module, BlockstorageClient
4747
)
4848

49-
def list_resources(self):
50-
# list only returns summary objects which have very little information. This causes false positives since we
51-
# compare only a handful of basic parameters. So do a get call and get the full
52-
# model objects for idempotence check.
53-
return [
54-
self.get_get_fn()(instance_configuration_id=instance_configuration.id).data
55-
for instance_configuration in super(
56-
InstanceConfigurationHelperCustom, self
57-
).list_resources()
58-
]
59-
6049
def get_instance_configuration_launch_details_from_instance(self, instance):
6150
launch_details = oci_common_utils.convert_input_data_to_model_class(
6251
to_dict(instance), InstanceConfigurationLaunchInstanceDetails
@@ -148,21 +137,6 @@ def get_create_model_dict_for_idempotence_check(self, create_model):
148137

149138

150139
class InstanceConfigurationActionsHelperCustom:
151-
# Launch method creates an instance but the generated method does not wait until the instance is in running state.
152-
# Override and wait until the instance reaches the ready state.
153-
# def launch(self):
154-
# instance = super(InstanceConfigurationActionsHelperCustom, self).launch()
155-
# compute_client = oci_config_utils.create_service_client(
156-
# self.module, ComputeClient
157-
# )
158-
# wait_response = oci.wait_until(
159-
# self.client,
160-
# compute_client.get_instance(instance_id=instance.id),
161-
# evaluate_response=lambda response: response.data.lifecycle_state
162-
# in oci_common_utils.DEFAULT_READY_STATES,
163-
# max_wait_seconds=self.get_wait_timeout(),
164-
# )
165-
# return wait_response.data
166140

167141
# instance_configuration launch action returns an instance and not instance_configuration. Currently the base
168142
# classes do not support custom return field names and use the resource types. Until the feature is added
@@ -176,16 +150,6 @@ def prepare_result(self, *args, **kwargs):
176150
return super_result
177151

178152

179-
class InstancePoolHelperCustom:
180-
def list_resources(self):
181-
# list only returns summary objects which does not have all the information in the create model. This causes
182-
# false positives. So do a get call and get the full model objects for idempotence check.
183-
return [
184-
self.get_get_fn()(instance_pool_id=instance_pool.id).data
185-
for instance_pool in super(InstancePoolHelperCustom, self).list_resources()
186-
]
187-
188-
189153
class InstancePoolActionsHelperCustom:
190154
LIFECYCLE_STATE_ATTACHED = "ATTACHED"
191155
LIFECYCLE_STATE_DETACHED = "DETACHED"

plugins/module_utils/oci_container_engine_custom_helpers.py

+23-6
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,29 @@
1212

1313

1414
class KubeconfigHelperCustom:
15-
def get_module_resource_id(self):
16-
return False
17-
18-
def get_matching_resource(self):
19-
return None
20-
2115
def create_resource(self):
2216
response_data = super(KubeconfigHelperCustom, self).create_resource()
2317
return to_text(response_data.content)
18+
19+
20+
class NodePoolHelperCustom:
21+
# Some attrs end with details and the get returns the same field without details
22+
# This case we should still match them for update and create
23+
def get_existing_resource_dict_for_idempotence_check(self, existing_resource):
24+
existing_resource_dict = super(
25+
NodePoolHelperCustom, self
26+
).get_existing_resource_dict_for_idempotence_check(existing_resource)
27+
if existing_resource_dict.get("node_source"):
28+
existing_resource_dict["node_source_details"] = existing_resource_dict.pop(
29+
"node_source"
30+
)
31+
return existing_resource_dict
32+
33+
def is_update_necessary(self, existing_resource_dict):
34+
if existing_resource_dict.get("node_source"):
35+
existing_resource_dict["node_source_details"] = existing_resource_dict.get(
36+
"node_source"
37+
)
38+
return super(NodePoolHelperCustom, self).is_update_necessary(
39+
existing_resource_dict
40+
)

0 commit comments

Comments
 (0)