summaryrefslogtreecommitdiff
path: root/azurelinuxagent/common/protocol/util.py
diff options
context:
space:
mode:
authorƁukasz 'sil2100' Zemczak <lukasz.zemczak@ubuntu.com>2018-02-05 17:25:14 +0100
committerusd-importer <ubuntu-server@lists.ubuntu.com>2018-02-05 19:15:55 +0000
commitbdfe3a4fa9bd487ec5f40e829742e127476d2c8a (patch)
tree947ecb04d5e2737883803034ab9885ddab70b816 /azurelinuxagent/common/protocol/util.py
parent6aaeb3237653102b5a376986f0ea73327a7a4379 (diff)
downloadvyos-walinuxagent-bdfe3a4fa9bd487ec5f40e829742e127476d2c8a.tar.gz
vyos-walinuxagent-bdfe3a4fa9bd487ec5f40e829742e127476d2c8a.zip
Import patches-unapplied version 2.2.21-0ubuntu1 to ubuntu/bionic-proposed
Imported using git-ubuntu import. Changelog parent: 6aaeb3237653102b5a376986f0ea73327a7a4379 New changelog entries: * New upstream release (LP: #1746628). * debian/patches/disable_import_test.patch: refreshed patch.
Diffstat (limited to 'azurelinuxagent/common/protocol/util.py')
-rw-r--r--azurelinuxagent/common/protocol/util.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/azurelinuxagent/common/protocol/util.py b/azurelinuxagent/common/protocol/util.py
index 3071d7a..b3ec373 100644
--- a/azurelinuxagent/common/protocol/util.py
+++ b/azurelinuxagent/common/protocol/util.py
@@ -26,16 +26,18 @@ import threading
import azurelinuxagent.common.conf as conf
import azurelinuxagent.common.logger as logger
+import azurelinuxagent.common.utils.fileutil as fileutil
+
from azurelinuxagent.common.exception import ProtocolError, OSUtilError, \
ProtocolNotFoundError, DhcpError
from azurelinuxagent.common.future import ustr
-import azurelinuxagent.common.utils.fileutil as fileutil
from azurelinuxagent.common.osutil import get_osutil
from azurelinuxagent.common.dhcp import get_dhcp_handler
from azurelinuxagent.common.protocol.ovfenv import OvfEnv
from azurelinuxagent.common.protocol.wire import WireProtocol
from azurelinuxagent.common.protocol.metadata import MetadataProtocol, \
METADATA_ENDPOINT
+from azurelinuxagent.common.utils.restutil import IOErrorCounter
OVF_FILE_NAME = "ovf-env.xml"
TAG_FILE_NAME = "useMetadataEndpoint.tag"
@@ -175,17 +177,20 @@ class ProtocolUtil(object):
self.clear_protocol()
for retry in range(0, MAX_RETRY):
- for protocol in protocols:
+ for protocol_name in protocols:
try:
- if protocol == "WireProtocol":
- return self._detect_wire_protocol()
-
- if protocol == "MetadataProtocol":
- return self._detect_metadata_protocol()
+ protocol = self._detect_wire_protocol() \
+ if protocol_name == "WireProtocol" \
+ else self._detect_metadata_protocol()
+
+ IOErrorCounter.set_protocol_endpoint(
+ endpoint=protocol.endpoint)
+
+ return protocol
except ProtocolError as e:
logger.info("Protocol endpoint not found: {0}, {1}",
- protocol, e)
+ protocol_name, e)
if retry < MAX_RETRY -1:
logger.info("Retry detect protocols: retry={0}", retry)