Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cloudinit/sources/DataSourceOracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,10 @@ def read_opc_metadata(*, fetch_vnics_data: bool = False):
`fetch_vnics_data` is True, else None

"""
retries = 1
# Per Oracle, there are short windows (measured in milliseconds) throughout
# an instance's lifetime where the IMDS is being updated and may 404 as a
# result. To work around these windows, we retry a couple of times.
retries = 2
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it'd clearly be better to retry only on the 404 in that case, but good enough.


def _fetch(metadata_version: int, path: str) -> dict:
headers = {
Expand Down
8 changes: 5 additions & 3 deletions cloudinit/sources/tests/test_oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,11 @@ def test_metadata_returned(
"v2_failure_count,v1_failure_count,expected_body,expectation",
[
(1, 0, json.loads(OPC_V2_METADATA), does_not_raise()),
(2, 0, json.loads(OPC_V1_METADATA), does_not_raise()),
(2, 1, json.loads(OPC_V1_METADATA), does_not_raise()),
(2, 2, None, pytest.raises(UrlError)),
(2, 0, json.loads(OPC_V2_METADATA), does_not_raise()),
(3, 0, json.loads(OPC_V1_METADATA), does_not_raise()),
(3, 1, json.loads(OPC_V1_METADATA), does_not_raise()),
(3, 2, json.loads(OPC_V1_METADATA), does_not_raise()),
(3, 3, None, pytest.raises(UrlError)),
]
)
def test_retries(self, v2_failure_count, v1_failure_count,
Expand Down