Skip to content

Commit

Permalink
Merge pull request #10 from oracle/release_2.2.0_2020-06-25-22-28-41
Browse files Browse the repository at this point in the history
Releasing version 2.2.0
  • Loading branch information
nalsaber authored Jun 25, 2020
2 parents 4c50eb6 + 77577c7 commit b342b18
Show file tree
Hide file tree
Showing 395 changed files with 24,137 additions and 2,823 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [2.2.0] - 2020-6-25

### Added:
- Added Domain Name System (DNS) modules
- Added Email modules
- Added Marketplace modules
- Added Monitoring modules
- Added Notifications modules
- Added Streaming modules
- Added Functions modules
- Added Database Data Guard modules
- Added new modules for Compute and Network
- Added subparameter `admission_controller_options` in the options parameter of module `oci_container_engine_cluster`
- Added `node_source_details` parameter in the `oci_container_engine_node_pool module`

### Changed:
- Please update to the latest version of OCI Python SDK.
- `compartment_id` parameter removed from `oci_database_maintenance_run.py`
- This parameter was optional and was unused by the module so is being removed

## [2.1.2-Beta] - 2020-6-9

### Changed:
Expand Down
24 changes: 24 additions & 0 deletions MigrationGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ No breaking changes
|oci_database_facts | oci_database_database_facts | Module name is the only breaking change
|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>
|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>
|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>
|oci_data_guard_association_facts | oci_database_data_guard_association_facts | Module name is the only breaking change
|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>
|oci_db_home_facts | oci_database_db_home_facts | Module name is the only breaking change
|oci_db_home_patch_facts | oci_database_db_home_patch_facts | Module name is the only breaking change
Expand Down Expand Up @@ -184,6 +186,15 @@ No breaking changes
|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>
|oci_autonomous_exadata_infrastructure_shape_facts | oci_database_autonomous_exadata_infrastructure_shape_facts | Module name is the only breaking change

#### Email

|old name | new name | migration notes
|-----------------------|-------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|oci_sender | oci_email_sender | Module name is the only breaking change
|oci_sender_facts | oci_email_sender_facts | Module name is the only breaking change
|oci_suppression | oci_email_suppression | Module name is the only breaking change
|oci_suppression_facts | oci_email_suppression_facts | Module name is the only breaking change

#### File Storage

|old name | new name | migration notes
Expand Down Expand Up @@ -343,3 +354,16 @@ No breaking changes
|oci_object_storage_object_lifecycle_policy_facts | oci_object_storage_object_lifecycle_policy_facts | Module name is the only breaking change
|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>
|oci_preauthenticated_request_facts | oci_object_storage_preauthenticated_request_facts | Module name is the only breaking change

#### DNS

|old name | new name | migration notes
|-------------------------------------------------|-----------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------
|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>
|oci_zone_facts | oci_dns_zone_facts | Module name is the only breaking change
|oci_zone_records | oci_dns_zone_records | Module name is the only breaking change
|oci_zone_records_facts | oci_dns_zone_records_facts | Module name is the only breaking change
|oci_domain_records | oci_dns_domain_records | Module name is the only breaking change
|oci_domain_records_facts | oci_dns_domain_records_facts | Module name is the only breaking change
|oci_rrset | oci_dns_rrset | Module name is the only breaking change
|oci_rrset_facts | oci_dns_rrset_facts | Module name is the only breaking change
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Oracle Cloud Infrastructure Ansible Collection - Beta
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:
> **ansible-galaxy collection install oracle.oci:2.1.2-beta**
# Oracle Cloud Infrastructure Ansible Collection

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

Expand Down Expand Up @@ -38,6 +35,13 @@ We have also added a new [User Guide](https://github.com/oracle/oci-ansible-coll
- Budget/Account management
- Health Checks
- Vault Secret and Key Management (KMS)
- Domain Name System (DNS)
- Email
- Marketplace
- Monitoring
- Notifications
- Streaming
- Functions


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

You can install it from [Ansible Galaxy](https://galaxy.ansible.com/oracle) using the command:
``` bash
$ ansible-galaxy collection install oracle.oci:2.1.2-beta
$ ansible-galaxy collection install oracle.oci
```
Notes:
* Collections is supported in Ansible 2.9+.
Expand Down
5 changes: 4 additions & 1 deletion UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,7 @@ There would be no ambiguity and it would only ever match the 50 GB block volume.

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:
- Use unique attributes or tags for resources of the same type so there is no potential for ambiguity in matching resources
- Specify optional values that you care about instead of relying on server side defaults
- Specify optional values that you care about instead of relying on server side defaults

### Support for `key_by` option
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.
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace: oracle
name: oci

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

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
Expand Down
4 changes: 2 additions & 2 deletions plugins/doc_fragments/oracle_creatable_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ModuleDocFragment(object):
type: bool
key_by:
description: The list of comma-separated attributes of this resource which should be used to uniquely
identify an instance of the resource. By default, all the attributes of a resource except
I(freeform_tags) are used to uniquely identify a resource.
identify an instance of the resource. By default, all the attributes of a resource are
used to uniquely identify a resource.
type: list
"""
39 changes: 32 additions & 7 deletions plugins/module_utils/oci_common_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@
]

CANCELLED_STATES = ["CANCELLED"]
FAILED_STATES = ["FAILED"]

WORK_REQUEST_COMPLETED_STATES = ["SUCCEEDED", "SUCCESS", "FAILED", "COMPLETED"]
WORK_REQUEST_SUCCESS_STATES = ["SUCCEEDED", "SUCCESS"]
WORK_REQUEST_FAILED_STATES = ["FAILED"]
WORK_REQUEST_FAILED_STATES = FAILED_STATES

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

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


def compare_lists(source_list, target_list):
def compare_lists(source_list, target_list, ignore_attr_if_not_in_target=False):
if source_list is None or target_list is None:
_debug(
"list is not subset because source list: {source_list} or target list: {target_list} is None".format(
Expand All @@ -308,7 +310,16 @@ def compare_lists(source_list, target_list):
)
return False

if all([is_in_list(target_list, element) for element in source_list]):
if all(
[
is_in_list(
target_list,
element,
ignore_attr_if_not_in_target=ignore_attr_if_not_in_target,
)
for element in source_list
]
):
return True

_debug(
Expand All @@ -317,15 +328,29 @@ def compare_lists(source_list, target_list):
return False


def is_in_list(target_list, element):
def is_in_list(target_list, element, ignore_attr_if_not_in_target=False):
if isinstance(element, dict):
if any(
[compare_dicts(element, target_element) for target_element in target_list]
[
compare_dicts(
element,
target_element,
ignore_attr_if_not_in_target=ignore_attr_if_not_in_target,
)
for target_element in target_list
]
):
return True
elif isinstance(element, list):
if any(
[compare_lists(element, target_element) for target_element in target_list]
[
compare_lists(
element,
target_element,
ignore_attr_if_not_in_target=ignore_attr_if_not_in_target,
)
for target_element in target_list
]
):
return True
else:
Expand Down
37 changes: 22 additions & 15 deletions plugins/module_utils/oci_compute_custom_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
try:
from oci.core import VirtualNetworkClient
from oci.util import to_dict
from oci.core.models import ImageShapeCompatibilityEntry
from oci.exceptions import ServiceError

HAS_OCI_PY_SDK = True
Expand Down Expand Up @@ -249,23 +248,31 @@ def get_exclude_attributes(self):


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

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

def get_existing_resource_dict_for_update(self):
try:
get_response = self.get_resource()
except ServiceError as se:
if se.status != 404:
raise
return dict()
else:
return to_dict(get_response.data)

def is_update_necessary(self, existing_resource_dict):

if not existing_resource_dict:
return True

return super(
ImageShapeCompatibilityEntryHelperCustom, self
).is_update_necessary(existing_resource_dict)


class VnicAttachmentHelperCustom:
def get_create_model_dict_for_idempotence_check(self, create_model):
Expand Down
36 changes: 0 additions & 36 deletions plugins/module_utils/oci_compute_management_custom_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,6 @@ def __init__(self, *args, **kwargs):
self.module, BlockstorageClient
)

def list_resources(self):
# list only returns summary objects which have very little information. This causes false positives since we
# compare only a handful of basic parameters. So do a get call and get the full
# model objects for idempotence check.
return [
self.get_get_fn()(instance_configuration_id=instance_configuration.id).data
for instance_configuration in super(
InstanceConfigurationHelperCustom, self
).list_resources()
]

def get_instance_configuration_launch_details_from_instance(self, instance):
launch_details = oci_common_utils.convert_input_data_to_model_class(
to_dict(instance), InstanceConfigurationLaunchInstanceDetails
Expand Down Expand Up @@ -148,21 +137,6 @@ def get_create_model_dict_for_idempotence_check(self, create_model):


class InstanceConfigurationActionsHelperCustom:
# Launch method creates an instance but the generated method does not wait until the instance is in running state.
# Override and wait until the instance reaches the ready state.
# def launch(self):
# instance = super(InstanceConfigurationActionsHelperCustom, self).launch()
# compute_client = oci_config_utils.create_service_client(
# self.module, ComputeClient
# )
# wait_response = oci.wait_until(
# self.client,
# compute_client.get_instance(instance_id=instance.id),
# evaluate_response=lambda response: response.data.lifecycle_state
# in oci_common_utils.DEFAULT_READY_STATES,
# max_wait_seconds=self.get_wait_timeout(),
# )
# return wait_response.data

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


class InstancePoolHelperCustom:
def list_resources(self):
# list only returns summary objects which does not have all the information in the create model. This causes
# false positives. So do a get call and get the full model objects for idempotence check.
return [
self.get_get_fn()(instance_pool_id=instance_pool.id).data
for instance_pool in super(InstancePoolHelperCustom, self).list_resources()
]


class InstancePoolActionsHelperCustom:
LIFECYCLE_STATE_ATTACHED = "ATTACHED"
LIFECYCLE_STATE_DETACHED = "DETACHED"
Expand Down
29 changes: 23 additions & 6 deletions plugins/module_utils/oci_container_engine_custom_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,29 @@


class KubeconfigHelperCustom:
def get_module_resource_id(self):
return False

def get_matching_resource(self):
return None

def create_resource(self):
response_data = super(KubeconfigHelperCustom, self).create_resource()
return to_text(response_data.content)


class NodePoolHelperCustom:
# Some attrs end with details and the get returns the same field without details
# This case we should still match them for update and create
def get_existing_resource_dict_for_idempotence_check(self, existing_resource):
existing_resource_dict = super(
NodePoolHelperCustom, self
).get_existing_resource_dict_for_idempotence_check(existing_resource)
if existing_resource_dict.get("node_source"):
existing_resource_dict["node_source_details"] = existing_resource_dict.pop(
"node_source"
)
return existing_resource_dict

def is_update_necessary(self, existing_resource_dict):
if existing_resource_dict.get("node_source"):
existing_resource_dict["node_source_details"] = existing_resource_dict.get(
"node_source"
)
return super(NodePoolHelperCustom, self).is_update_necessary(
existing_resource_dict
)
Loading

0 comments on commit b342b18

Please sign in to comment.