Repository: Azure/WALinuxAgent
Pull request #480 (2016-11-07 19:51:20)

Add restart_if function for Alpine
We need this for Azure-provided DNS to work on our instances.

It attempts to call `ifdown eth0 && ifup eth0` by default, this does not work for us because they expect the interfaces to be configured statically in `/etc/network/interfaces`.  We configure them dynamically using `dhcpcd`, so a simple SIGHUP to that daemon will suffice to renew the DHCP lease after the agent has set hostname.

@ahmetalpbalkan @hglkrijger @brendandixon PTAL

Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>


Patch:
diff --git a/azurelinuxagent/common/osutil/alpine.py b/azurelinuxagent/common/osutil/alpine.py
index 3b597552..202d01d5 100644
--- a/azurelinuxagent/common/osutil/alpine.py
+++ b/azurelinuxagent/common/osutil/alpine.py
@@ -17,6 +17,7 @@
 # Requires Python 2.4+ and Openssl 1.0+
 #
 
+import azurelinuxagent.common.logger as logger
 import azurelinuxagent.common.utils.shellutil as shellutil
 from azurelinuxagent.common.osutil.default import DefaultOSUtil
 
@@ -30,7 +31,16 @@ class AlpineOSUtil(DefaultOSUtil):
 
     def get_dhcp_pid(self):
         ret = shellutil.run_get_output('pidof dhcpcd', chk_err=False)
-        return ret[1] if ret[0] == 0 else None
+        if ret[0] == 0:
+            logger.info('dhcpcd is pid {}'.format(ret[1]))
+            return ret[1].strip()
+        return None
+
+    def restart_if(self, ifname):
+        logger.info('restarting {} (sort of, actually SIGHUPing dhcpcd)'.format(ifname))
+        pid = self.get_dhcp_pid()
+        if pid != None:
+            ret = shellutil.run_get_output('kill -HUP {}'.format(pid))
 
     def set_ssh_client_alive_interval(self):
         # Alpine will handle this.
diff --git a/azurelinuxagent/common/osutil/clearlinux.py b/azurelinuxagent/common/osutil/clearlinux.py
deleted file mode 100644
index 5116ff43..00000000
--- a/azurelinuxagent/common/osutil/clearlinux.py
+++ /dev/null
@@ -1,91 +0,0 @@
-#
-# Copyright 2014 Microsoft Corporation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Requires Python 2.4+ and Openssl 1.0+
-#
-
-import os
-import re
-import pwd
-import shutil
-import socket
-import array
-import struct
-import fcntl
-import time
-import base64
-import azurelinuxagent.common.conf as conf
-import azurelinuxagent.common.logger as logger
-import azurelinuxagent.common.utils.fileutil as fileutil
-import azurelinuxagent.common.utils.shellutil as shellutil
-import azurelinuxagent.common.utils.textutil as textutil
-from azurelinuxagent.common.osutil.default import DefaultOSUtil
-
-class ClearLinuxUtil(DefaultOSUtil):
-    def __init__(self):
-        super(ClearLinuxUtil, self).__init__()
-        self.agent_conf_file_path = '/usr/share/defaults/waagent/waagent.conf'
-
-    def is_dhcp_enabled(self):
-        return True
-
-    def start_network(self) :
-        return shellutil.run("systemctl start systemd-networkd", chk_err=False)
-
-    def restart_if(self, iface):
-        shellutil.run("systemctl restart systemd-networkd")
-
-    def restart_ssh_service(self):
-        # SSH is socket activated. No need to restart it.
-        pass
-
-    def stop_dhcp_service(self):
-        return shellutil.run("systemctl stop systemd-networkd", chk_err=False)
-
-    def start_dhcp_service(self):
-        return shellutil.run("systemctl start systemd-networkd", chk_err=False)
-
-    def start_agent_service(self):
-        return shellutil.run("systemctl start waagent", chk_err=False)
-
-    def stop_agent_service(self):
-        return shellutil.run("systemctl stop waagent", chk_err=False)
-
-    def get_dhcp_pid(self):
-        ret= shellutil.run_get_output("pidof systemd-networkd")
-        return ret[1] if ret[0] == 0 else None
-
-    def conf_sshd(self, disable_password):
-        # Don't whack the system default sshd conf
-        pass
-
-    def del_root_password(self):
-        try:
-            passwd_file_path = conf.get_passwd_file_path()
-            try:
-                passwd_content = fileutil.read_file(passwd_file_path)
-                if not passwd_content:
-                    # Empty file is no better than no file
-                    raise FileNotFoundError
-            except FileNotFoundError:
-                new_passwd = ["root:*LOCK*:14600::::::"]
-            else:
-                passwd = passwd_content.split('\n')
-                new_passwd = [x for x in passwd if not x.startswith("root:")]
-                new_passwd.insert(0, "root:*LOCK*:14600::::::")
-            fileutil.write_file(passwd_file_path, "\n".join(new_passwd))
-        except IOError as e:
-            raise OSUtilError("Failed to delete root password:{0}".format(e))
-        pass
diff --git a/azurelinuxagent/common/osutil/factory.py b/azurelinuxagent/common/osutil/factory.py
index cdfcd747..62bbf863 100644
--- a/azurelinuxagent/common/osutil/factory.py
+++ b/azurelinuxagent/common/osutil/factory.py
@@ -21,7 +21,6 @@ from azurelinuxagent.common.version import DISTRO_NAME, DISTRO_VERSION, \
                                      DISTRO_FULL_NAME
 
 from .default import DefaultOSUtil
-from .clearlinux import ClearLinuxUtil
 from .coreos import CoreOSUtil
 from .debian import DebianOSUtil
 from .freebsd import FreeBSDOSUtil
@@ -33,8 +32,6 @@ from .alpine import AlpineOSUtil
 
 def get_osutil(distro_name=DISTRO_NAME, distro_version=DISTRO_VERSION,
                distro_full_name=DISTRO_FULL_NAME):
-    if distro_name == "clear linux software for intel architecture":
-        return ClearLinuxUtil()
     if distro_name == "ubuntu":
         if Version(distro_version) == Version("12.04") or \
            Version(distro_version) == Version("12.10"):
diff --git a/azurelinuxagent/common/protocol/hostplugin.py b/azurelinuxagent/common/protocol/hostplugin.py
index 33ed2ec3..1bfee265 100644
--- a/azurelinuxagent/common/protocol/hostplugin.py
+++ b/azurelinuxagent/common/protocol/hostplugin.py
@@ -22,25 +22,20 @@ from azurelinuxagent.common.utils import textutil
 
 HOST_PLUGIN_PORT = 32526
 URI_FORMAT_GET_API_VERSIONS = "http://{0}:{1}/versions"
-URI_FORMAT_GET_EXTENSION_ARTIFACT = "http://{0}:{1}/extensionArtifact"
 URI_FORMAT_PUT_VM_STATUS = "http://{0}:{1}/status"
 URI_FORMAT_PUT_LOG = "http://{0}:{1}/vmAgentLog"
 API_VERSION = "2015-09-01"
-HEADER_CONTAINER_ID = "x-ms-containerid"
-HEADER_VERSION = "x-ms-version"
-HEADER_HOST_CONFIG_NAME = "x-ms-host-config-name"
 
 
 class HostPluginProtocol(object):
-    def __init__(self, endpoint, container_id, role_config_name):
+    def __init__(self, endpoint, goal_state):
         if endpoint is None:
             raise ProtocolError("Host plugin endpoint not provided")
         self.is_initialized = False
         self.is_available = False
         self.api_versions = None
         self.endpoint = endpoint
-        self.container_id = container_id
-        self.role_config_name = role_config_name
+        self.goal_state = goal_state
 
     def ensure_initialized(self):
         if not self.is_initialized:
@@ -54,7 +49,7 @@ class HostPluginProtocol(object):
                                                  HOST_PLUGIN_PORT)
         logger.info("getting API versions at [{0}]".format(url))
         try:
-            headers = { HEADER_CONTAINER_ID: self.container_id }
+            headers = { "x-ms-containerid": self.goal_state.container_id }
             response = restutil.http_get(url, headers)
             if response.status != httpclient.OK:
                 logger.error(
@@ -66,24 +61,6 @@ class HostPluginProtocol(object):
             logger.error("get API versions failed with [{0}]".format(e))
             return []
 
-    def get_extension_artifact_url_and_headers(self, artifact_url, artifact_manifest_url = None):
-        if not self.ensure_initialized():
-            logger.error("host plugin channel is not available")
-            return
-        if artifact_url is None or artifact_url.isspace():
-            logger.error("no extension artifact url was provided")
-            return
-
-        url = URI_FORMAT_GET_EXTENSION_ARTIFACT.format(self.endpoint, HOST_PLUGIN_PORT)
-        headers = {HEADER_VERSION: API_VERSION,
-                   HEADER_CONTAINER_ID: self.container_id,
-                   HEADER_HOST_CONFIG_NAME: self.role_config_name,
-                   "x-ms-artifact-location": artifact_url}
-        if artifact_manifest_url is not None:
-            headers["x-ms-artifact-manifest-location"] = artifact_manifest_url
-
-        return url, headers
-
     def put_vm_status(self, status_blob, sas_url):
         """
         Try to upload the VM status via the host plugin /status channel
@@ -99,10 +76,10 @@ class HostPluginProtocol(object):
         url = URI_FORMAT_PUT_VM_STATUS.format(self.endpoint, HOST_PLUGIN_PORT)
         logger.verbose("Posting VM status to host channel [{0}]".format(url))
         status = textutil.b64encode(status_blob.data)
-        headers = {HEADER_VERSION: API_VERSION,
+        headers = {"x-ms-version": API_VERSION,
                    "Content-type": "application/json",
-                   HEADER_CONTAINER_ID: self.container_id,
-                   HEADER_HOST_CONFIG_NAME: self.role_config_name}
+                   "x-ms-containerid": self.goal_state.container_id,
+                   "x-ms-host-config-name": self.goal_state.role_instance_config_name}
         blob_headers = [{'headerName': 'x-ms-version',
                          'headerValue': status_blob.__storage_version__},
                         {'headerName': 'x-ms-blob-type',
diff --git a/azurelinuxagent/common/protocol/restapi.py b/azurelinuxagent/common/protocol/restapi.py
index d9ade02f..aa7872bb 100644
--- a/azurelinuxagent/common/protocol/restapi.py
+++ b/azurelinuxagent/common/protocol/restapi.py
@@ -282,9 +282,6 @@ class Protocol(DataContract):
     def get_ext_handler_pkgs(self, extension):
         raise NotImplementedError()
 
-    def get_in_vm_artifacts_profile(self):
-        raise NotImplementedError()
-
     def download_ext_handler_pkg(self, uri):
         try:
             resp = restutil.http_get(uri, chk_proxy=True)
diff --git a/azurelinuxagent/common/protocol/wire.py b/azurelinuxagent/common/protocol/wire.py
index a9c2e02f..75d6eb6e 100644
--- a/azurelinuxagent/common/protocol/wire.py
+++ b/azurelinuxagent/common/protocol/wire.py
@@ -25,7 +25,7 @@ import azurelinuxagent.common.conf as conf
 from azurelinuxagent.common.exception import ProtocolNotFoundError
 from azurelinuxagent.common.future import httpclient, bytebuffer
 from azurelinuxagent.common.utils.textutil import parse_doc, findall, find, \
-    findtext, getattrib, gettext, remove_bom, get_bytes_from_pem, parse_json
+    findtext, getattrib, gettext, remove_bom, get_bytes_from_pem
 import azurelinuxagent.common.utils.fileutil as fileutil
 from azurelinuxagent.common.utils.cryptutil import CryptUtil
 from azurelinuxagent.common.protocol.restapi import *
@@ -139,10 +139,6 @@ class WireProtocol(Protocol):
         man = self.client.get_ext_manifest(ext_handler, goal_state)
         return man.pkg_list
 
-    def get_in_vm_artifacts_profile(self):
-        logger.verbose("Get In-VM Artifacts Profile")
-        return self.client.get_in_vm_artifacts_profile()
-
     def report_provision_status(self, provision_status):
         validate_param("provision_status", provision_status, ProvisionStatus)
 
@@ -707,8 +703,7 @@ class WireClient(object):
                 self.update_certs(goal_state)
                 self.update_ext_conf(goal_state)
                 if self.host_plugin is not None:
-                    self.host_plugin.container_id = goal_state.container_id
-                    self.host_plugin.role_config_name = goal_state.role_instance_config_name
+                    self.host_plugin.goal_state = goal_state
                 return
             except WireProtocolResourceGone:
                 logger.info("Incarnation is out of date. Update goalstate.")
@@ -919,59 +914,9 @@ class WireClient(object):
 
     def get_host_plugin(self):
         if self.host_plugin is None:
-            goal_state = self.get_goal_state()
-            self.host_plugin = HostPluginProtocol(self.endpoint,
-                                                  goal_state.container_id,
-                                                  goal_state.role_instance_config_name)
+            self.host_plugin = HostPluginProtocol(self.endpoint, self.get_goal_state())
         return self.host_plugin
 
-    def get_in_vm_artifacts_profile(self):
-        ext_conf = self.ext_conf
-        if ext_conf and \
-                ext_conf.in_vm_artifacts_profile_blob and not \
-                ext_conf.in_vm_artifacts_profile_blob.isspace():
-            # try with the default protocol
-            in_vm_artifacts_profile_byte_arr = \
-                self._get_in_vm_artifacts_profile(ext_conf.in_vm_artifacts_profile_blob)
-
-            # try with host GA plugin
-            if in_vm_artifacts_profile_byte_arr is None:
-                logger.warn(
-                    "Failed to get extension artifacts profile using the default protocol. Try with HostGAPlugin")
-                host_plugin_endpoint, headers = \
-                    self.get_host_plugin().get_extension_artifact_url_and_headers(ext_conf.in_vm_artifacts_profile_blob)
-                in_vm_artifacts_profile_byte_arr = self._get_in_vm_artifacts_profile(host_plugin_endpoint, headers)
-
-            in_vm_artifacts_profile_json = self.decode_config(in_vm_artifacts_profile_byte_arr)
-            if in_vm_artifacts_profile_json and not in_vm_artifacts_profile_json.isspace():
-                return InVMArtifactsProfile(in_vm_artifacts_profile_json)
-
-    def _get_in_vm_artifacts_profile(self, blob_url, headers=None):
-        result = None
-        try:
-            resp = self.call_storage_service(restutil.http_get, blob_url, headers=headers)
-            response_body = resp.read()
-            if resp.status < 400:
-                decoded = self.decode_config(response_body)
-                if decoded and not decoded.isspace():
-                    result = InVMArtifactsProfile(decoded)
-            else:
-                logger.warn("Unexpected http status '{0}' is returned with the message '{1}'",
-                            resp.status,
-                            response_body)
-
-        except HttpError as e:
-            logger.warn("Encountered HttpError while getting InVMArtifactsProfile from '{0}' "
-                        "using the default protocol: [{1}]", blob_url, e)
-        else:
-            if resp.status == httpclient.OK:
-                result = resp.read()
-            else:
-                logger.warn("Failed to get InVMArtifactsProfile with status [{0}] from '{1}' "
-                            "using the default protocol", resp.status, blob_url)
-        return result
-
-
 class VersionInfo(object):
     def __init__(self, xml_text):
         """
@@ -1200,7 +1145,6 @@ class ExtensionsConfig(object):
         self.ext_handlers = ExtHandlerList()
         self.vmagent_manifests = VMAgentManifestList()
         self.status_upload_blob = None
-        self.in_vm_artifacts_profile_blob = None
         if xml_text is not None:
             self.parse(xml_text)
 
@@ -1235,7 +1179,6 @@ class ExtensionsConfig(object):
             self.parse_plugin_settings(ext_handler, plugin_settings)
 
         self.status_upload_blob = findtext(xml_doc, "StatusUploadBlob")
-        self.in_vm_artifacts_profile_blob = findtext(xml_doc, "InVMArtifactsProfileBlob")
 
     def parse_plugin(self, plugin):
         ext_handler = ExtHandler()
@@ -1337,27 +1280,3 @@ class ExtensionManifest(object):
 
             pkg.isinternal = isinternal
             self.pkg_list.versions.append(pkg)
-
-
-# Do not extend this class
-class InVMArtifactsProfile(object):
-    '''
-    deserialized json string of InVMArtifactsProfile.
-    It is expected to contain the following fields:
-    * inVMArtifactsProfileBlobSeqNo
-    * profileId (optional)
-    * onHold (optional)
-    * certificateThumbprint (optional)
-    * encryptedHealthChecks (optional)
-    * encryptedApplicationProfile (optional)
-    '''
-
-    def __init__(self, in_vm_artifacts_profile_json):
-        if in_vm_artifacts_profile_json and not in_vm_artifacts_profile_json.isspace():
-            self.__dict__.update(parse_json(in_vm_artifacts_profile_json))
-
-    def is_extension_handlers_handling_on_hold(self):
-        # hasattr() is not available in Python 2.6
-        if 'onHold' in self.__dict__:
-            return self.onHold.lower() == 'true'
-        return False
diff --git a/azurelinuxagent/common/utils/textutil.py b/azurelinuxagent/common/utils/textutil.py
index f60df26a..db320a62 100644
--- a/azurelinuxagent/common/utils/textutil.py
+++ b/azurelinuxagent/common/utils/textutil.py
@@ -278,30 +278,15 @@ def b64encode(s):
         return base64.b64encode(bytes(s, 'utf-8')).decode('utf-8')
     return base64.b64encode(s)
 
-
 def b64decode(s):
     from azurelinuxagent.common.version import PY_VERSION_MAJOR
     if PY_VERSION_MAJOR > 2:
         return base64.b64decode(s).decode('utf-8')
     return base64.b64decode(s)
 
-
 def safe_shlex_split(s):
     import shlex
     from azurelinuxagent.common.version import PY_VERSION
     if PY_VERSION[:2] == (2, 6):
         return shlex.split(s.encode('utf-8'))
     return shlex.split(s)
-
-
-def parse_json(json_str):
-    """
-    Parse json string and return a resulting dictionary
-    """
-    # trim null and whitespaces
-    result = None
-    if json_str and not json_str.isspace():
-        import json
-        result = json.loads(json_str.rstrip(' \t\r\n\0'))
-
-    return result
diff --git a/azurelinuxagent/common/version.py b/azurelinuxagent/common/version.py
index b57b8fd2..b2d970b3 100644
--- a/azurelinuxagent/common/version.py
+++ b/azurelinuxagent/common/version.py
@@ -39,16 +39,11 @@ def get_distro():
         osinfo = platform.dist()
 
     # The platform.py lib has issue with detecting oracle linux distribution.
-    # Merge the following patch provided by oracle as a temporary fix.
+    # Merge the following patch provided by oracle as a temparory fix.
     if os.path.exists("/etc/oracle-release"):
         osinfo[2] = "oracle"
         osinfo[3] = "Oracle Linux"
 
-    # The platform.py lib has issue with detecting BIG-IP linux distribution.
-    # Merge the following patch provided by F5.
-    if os.path.exists("/shared/vadc"):
-        osinfo = get_f5_platform()
-
     # Remove trailing whitespace and quote in distro name
     osinfo[0] = osinfo[0].strip('"').strip(' ').lower()
     return osinfo
@@ -139,33 +134,3 @@ def is_snappy():
 
 if is_snappy():
     DISTRO_FULL_NAME = "Snappy Ubuntu Core"
-
-"""
-Add this workaround for detecting F5 products because BIG-IP/IQ/etc do not show
-their version info in the /etc/product-version location. Instead, the version
-and product information is contained in the /VERSION file.
-"""
-def get_f5_platform():
-    result = [None,None,None,None]
-    f5_version = re.compile("^Version: (\d+\.\d+\.\d+)")
-    f5_product = re.compile("^Product: ([\w-]+)")
-
-    with open('/VERSION', 'r') as fh:
-        content = fh.readlines()
-        for line in content:
-            version_matches = f5_version.match(line)
-            product_matches = f5_product.match(line)
-            if version_matches:
-                result[1] = version_matches.group(1)
-            elif product_matches:
-                result[3] = product_matches.group(1)
-                if result[3] == "BIG-IP":
-                    result[0] = "bigip"
-                    result[2] = "bigip"
-                elif result[3] == "BIG-IQ":
-                    result[0] = "bigiq"
-                    result[2] = "bigiq"
-                elif result[3] == "iWorkflow":
-                    result[0] = "iworkflow"
-                    result[2] = "iworkflow"
-    return result
diff --git a/azurelinuxagent/ga/exthandlers.py b/azurelinuxagent/ga/exthandlers.py
index dda122c6..192300e3 100644
--- a/azurelinuxagent/ga/exthandlers.py
+++ b/azurelinuxagent/ga/exthandlers.py
@@ -195,12 +195,6 @@ class ExtHandlersHandler(object):
             logger.verbose("No ext handler config found")
             return
 
-        in_vm_artifacts_profile = self.protocol.get_in_vm_artifacts_profile()
-        if in_vm_artifacts_profile and \
-           in_vm_artifacts_profile.is_extension_handlers_handling_on_hold():
-            logger.info("Handling Extension handlers is on hold")
-            return
-
         for ext_handler in self.ext_handlers.extHandlers:
             #TODO handle install in sequence, enable in parallel
             self.handle_ext_handler(ext_handler, etag)
diff --git a/azurelinuxagent/ga/update.py b/azurelinuxagent/ga/update.py
index 850315d3..e95ff51e 100644
--- a/azurelinuxagent/ga/update.py
+++ b/azurelinuxagent/ga/update.py
@@ -302,7 +302,7 @@ class UpdateHandler(object):
 
     def _emit_restart_event(self):
         if not self._is_clean_start:
-            msg = u"{0} did not terminate cleanly".format(CURRENT_AGENT)
+            msg = u"{0} unexpectedly restarted".format(CURRENT_AGENT)
             logger.info(msg)
             add_event(
                 AGENT_NAME,
@@ -345,8 +345,7 @@ class UpdateHandler(object):
                 message=msg)
             return False
 
-        manifests = [m for m in manifest_list.vmAgentManifests \
-                        if m.family == family and len(m.versionsManifestUris) > 0]
+        manifests = [m for m in manifest_list.vmAgentManifests if m.family == family]
         if len(manifests) == 0:
             logger.info(u"Incarnation {0} has no agent family {1} updates", etag, family)
             return False
diff --git a/azurelinuxagent/pa/deprovision/clearlinux.py b/azurelinuxagent/pa/deprovision/clearlinux.py
deleted file mode 100644
index 097891b7..00000000
--- a/azurelinuxagent/pa/deprovision/clearlinux.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Microsoft Azure Linux Agent
-#
-# Copyright 2014 Microsoft Corporation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Requires Python 2.4+ and Openssl 1.0+
-#
-
-import azurelinuxagent.common.utils.fileutil as fileutil
-from azurelinuxagent.pa.deprovision.default import DeprovisionHandler, \
-                                                   DeprovisionAction
-
-class ClearLinuxDeprovisionHandler(DeprovisionHandler):
-    def __init__(self, distro):
-        self.distro = distro
-
-    def setup(self, deluser):
-        warnings, actions = super(ClearLinuxDeprovisionHandler, self).setup(deluser)
-        # Probably should just wipe /etc and /var here
-        return warnings, actions
diff --git a/azurelinuxagent/pa/deprovision/factory.py b/azurelinuxagent/pa/deprovision/factory.py
index 72a5be19..dd01633c 100644
--- a/azurelinuxagent/pa/deprovision/factory.py
+++ b/azurelinuxagent/pa/deprovision/factory.py
@@ -21,7 +21,6 @@ from azurelinuxagent.common.version import DISTRO_NAME, DISTRO_VERSION, \
                                      DISTRO_FULL_NAME
 
 from .default import DeprovisionHandler
-from .clearlinux import ClearLinuxDeprovisionHandler
 from .coreos import CoreOSDeprovisionHandler
 from .ubuntu import UbuntuDeprovisionHandler
 
@@ -32,8 +31,6 @@ def get_deprovision_handler(distro_name=DISTRO_NAME,
         return UbuntuDeprovisionHandler()
     if distro_name == "coreos":
         return CoreOSDeprovisionHandler()
-    if distro_name == "clear linux":
-        return ClearLinuxDeprovisionHandler()
 
     return DeprovisionHandler()
 
diff --git a/config/clearlinux/waagent.conf b/config/clearlinux/waagent.conf
deleted file mode 100644
index 4e19fa3b..00000000
--- a/config/clearlinux/waagent.conf
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# Microsoft Azure Linux Agent Configuration
-#
-
-# Specified program is invoked with the argument "Ready" when we report ready status
-# to the endpoint server.
-Role.StateConsumer=None
-
-# Specified program is invoked with XML file argument specifying role
-#  configuration.
-Role.ConfigurationConsumer=None
-
-# Specified program is invoked with XML file argument specifying role topology.
-Role.TopologyConsumer=None
-
-# Enable instance creation
-Provisioning.Enabled=y
-
-# Password authentication for root account will be unavailable.
-Provisioning.DeleteRootPassword=y
-
-# Generate fresh host key pair.
-Provisioning.RegenerateSshHostKeyPair=y
-
-# Supported values are "rsa", "dsa" and "ecdsa".
-Provisioning.SshHostKeyPairType=rsa
-
-# Monitor host name changes and publish changes via DHCP requests.
-Provisioning.MonitorHostName=y
-
-# Decode CustomData from Base64.
-Provisioning.DecodeCustomData=y
-
-# Execute CustomData after provisioning.
-Provisioning.ExecuteCustomData=n
-
-# Allow reset password of sys user
-Provisioning.AllowResetSysUser=n
-
-# Format if unformatted. If 'n', resource disk will not be mounted.
-ResourceDisk.Format=y
-
-# File system on the resource disk
-# Typically ext3 or ext4. FreeBSD images should use 'ufs2' here.
-ResourceDisk.Filesystem=ext4
-
-# Mount point for the resource disk
-ResourceDisk.MountPoint=/mnt/resource
-
-# Create and use swapfile on resource disk.
-ResourceDisk.EnableSwap=n
-
-# Size of the swapfile.
-ResourceDisk.SwapSizeMB=0
-
-# Enable verbose logging (y|n)
-Logs.Verbose=n
-
-# Root device timeout in seconds.
-OS.RootDeviceScsiTimeout=300
-
-# If "None", the system default version is used.
-OS.OpensslPath=None
-
-# Enable or disable self-update, default is enabled
-AutoUpdate.Enabled=y
-AutoUpdate.GAFamily=Prod
diff --git a/init/clearlinux/waagent.service b/init/clearlinux/waagent.service
deleted file mode 100644
index 9afee454..00000000
--- a/init/clearlinux/waagent.service
+++ /dev/null
@@ -1,16 +0,0 @@
-[Unit]
-Description=Azure Linux Agent
-Wants=network-online.target sshd.service sshd-keygen.service
-After=network-online.target
-
-ConditionFileIsExecutable=/usr/bin/waagent
-ConditionPathExists=/usr/share/defaults/waagent/waagent.conf
-
-[Service]
-Type=simple
-ExecStart=/usr/bin/python -u /usr/bin/waagent -daemon
-Restart=always
-RestartSec=5
-
-[Install]
-WantedBy=multi-user.target
diff --git a/setup.py b/setup.py
index 68f70b6e..5f050802 100755
--- a/setup.py
+++ b/setup.py
@@ -96,12 +96,6 @@ def get_data_files(name, version, fullname):
         set_udev_files(data_files)
         set_files(data_files, dest="/usr/share/oem",
                   src=["init/coreos/cloud-config.yml"])
-    elif name == 'clear linux software for intel architecture':
-        set_bin_files(data_files, dest="/usr/bin")
-        set_conf_files(data_files, dest="/usr/share/defaults/waagent",
-                       src=["config/clearlinux/waagent.conf"])
-        set_systemd_files(data_files, dest='/usr/lib/systemd/system',
-                          src=["init/clearlinux/waagent.service"])
     elif name == 'ubuntu':
         set_bin_files(data_files)
         set_conf_files(data_files, src=["config/ubuntu/waagent.conf"])


Test patch:
diff --git a/tests/common/test_version.py b/tests/common/test_version.py
index 306ea16f..6a4dc387 100644
--- a/tests/common/test_version.py
+++ b/tests/common/test_version.py
@@ -20,14 +20,12 @@ from __future__ import print_function
 import copy
 import glob
 import json
-import mock
 import os
 import platform
 import random
 import subprocess
 import sys
 import tempfile
-import textwrap
 import zipfile
 
 from tests.protocol.mockwiredata import *
@@ -36,7 +34,6 @@ from tests.tools import *
 import azurelinuxagent.common.conf as conf
 import azurelinuxagent.common.logger as logger
 import azurelinuxagent.common.utils.fileutil as fileutil
-import azurelinuxagent.common.version as version
 
 from azurelinuxagent.common.utils.flexible_version import FlexibleVersion
 from azurelinuxagent.common.version import *
@@ -66,109 +63,3 @@ class TestCurrentAgentName(AgentTestCase):
         self.assertEqual(agent, current_agent)
         self.assertEqual(version, str(current_version))
         return
-
-class TestGetF5Platforms(AgentTestCase):
-    def test_get_f5_platform_bigip_12_1_1(self):
-        version_file = textwrap.dedent("""
-        Product: BIG-IP
-        Version: 12.1.1
-        Build: 0.0.184
-        Sequence: 12.1.1.0.0.184.0
-        BaseBuild: 0.0.184
-        Edition: Final
-        Date: Thu Aug 11 17:09:01 PDT 2016
-        Built: 160811170901
-        Changelist: 1874858
-        JobID: 705993""")
-
-        mo = mock.mock_open(read_data=version_file)
-        with patch(open_patch(), mo):
-            platform = version.get_f5_platform()
-            self.assertTrue(platform[0] == 'bigip')
-            self.assertTrue(platform[1] == '12.1.1')
-            self.assertTrue(platform[2] == 'bigip')
-            self.assertTrue(platform[3] == 'BIG-IP')
-
-    def test_get_f5_platform_bigip_12_1_0_hf1(self):
-        version_file = textwrap.dedent("""
-        Product: BIG-IP
-        Version: 12.1.0
-        Build: 1.0.1447
-        Sequence: 12.1.0.1.0.1447.0
-        BaseBuild: 0.0.1434
-        Edition: Hotfix HF1
-        Date: Wed Jun  8 13:41:59 PDT 2016
-        Built: 160608134159
-        Changelist: 1773831
-        JobID: 673467""")
-
-        mo = mock.mock_open(read_data=version_file)
-        with patch(open_patch(), mo):
-            platform = version.get_f5_platform()
-            self.assertTrue(platform[0] == 'bigip')
-            self.assertTrue(platform[1] == '12.1.0')
-            self.assertTrue(platform[2] == 'bigip')
-            self.assertTrue(platform[3] == 'BIG-IP')
-
-    def test_get_f5_platform_bigip_12_0_0(self):
-        version_file = textwrap.dedent("""
-        Product: BIG-IP
-        Version: 12.0.0
-        Build: 0.0.606
-        Sequence: 12.0.0.0.0.606.0
-        BaseBuild: 0.0.606
-        Edition: Final
-        Date: Fri Aug 21 13:29:22 PDT 2015
-        Built: 150821132922
-        Changelist: 1486072
-        JobID: 536212""")
-
-        mo = mock.mock_open(read_data=version_file)
-        with patch(open_patch(), mo):
-            platform = version.get_f5_platform()
-            self.assertTrue(platform[0] == 'bigip')
-            self.assertTrue(platform[1] == '12.0.0')
-            self.assertTrue(platform[2] == 'bigip')
-            self.assertTrue(platform[3] == 'BIG-IP')
-
-    def test_get_f5_platform_iworkflow_2_0_1(self):
-        version_file = textwrap.dedent("""
-        Product: iWorkflow
-        Version: 2.0.1
-        Build: 0.0.9842
-        Sequence: 2.0.1.0.0.9842.0
-        BaseBuild: 0.0.9842
-        Edition: Final
-        Date: Sat Oct  1 22:52:08 PDT 2016
-        Built: 161001225208
-        Changelist: 1924048
-        JobID: 734712""")
-
-        mo = mock.mock_open(read_data=version_file)
-        with patch(open_patch(), mo):
-            platform = version.get_f5_platform()
-            self.assertTrue(platform[0] == 'iworkflow')
-            self.assertTrue(platform[1] == '2.0.1')
-            self.assertTrue(platform[2] == 'iworkflow')
-            self.assertTrue(platform[3] == 'iWorkflow')
-
-    def test_get_f5_platform_bigiq_5_1_0(self):
-        version_file = textwrap.dedent("""
-        Product: BIG-IQ
-        Version: 5.1.0
-        Build: 0.0.631
-        Sequence: 5.1.0.0.0.631.0
-        BaseBuild: 0.0.631
-        Edition: Final
-        Date: Thu Sep 15 19:55:43 PDT 2016
-        Built: 160915195543
-        Changelist: 1907534
-        JobID: 726344""")
-
-        mo = mock.mock_open(read_data=version_file)
-        with patch(open_patch(), mo):
-            platform = version.get_f5_platform()
-            self.assertTrue(platform[0] == 'bigiq')
-            self.assertTrue(platform[1] == '5.1.0')
-            self.assertTrue(platform[2] == 'bigiq')
-            self.assertTrue(platform[3] == 'BIG-IQ')
diff --git a/tests/data/wire/ext_conf_missing_family.xml b/tests/data/wire/ext_conf_missing_family.xml
deleted file mode 100644
index 40100779..00000000
--- a/tests/data/wire/ext_conf_missing_family.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?> 
-<Extensions version="1.0.0.0" goalStateIncarnation="1">
-    <GuestAgentExtension 
-        xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
-        <GAFamilies>
-            <GAFamily>
-                <Name>Prod</Name>
-                <Uris />
-            </GAFamily>
-            <GAFamily>
-                <Name>Test</Name>
-                <Uris>
-                    <Uri>https://rdfepirv2bl2prdstr01.blob.core.windows.net/7d89d439b79f4452950452399add2c90/Microsoft.OSTCLinuxAgent_Test_useast_manifest.xml</Uri>
-                    <Uri>https://rdfepirv2bl2prdstr02.blob.core.windows.net/7d89d439b79f4452950452399add2c90/Microsoft.OSTCLinuxAgent_Test_useast_manifest.xml</Uri>
-                    <Uri>https://rdfepirv2bl2prdstr03.blob.core.windows.net/7d89d439b79f4452950452399add2c90/Microsoft.OSTCLinuxAgent_Test_useast_manifest.xml</Uri>
-                    <Uri>https://rdfepirv2bl2prdstr04.blob.core.windows.net/7d89d439b79f4452950452399add2c90/Microsoft.OSTCLinuxAgent_Test_useast_manifest.xml</Uri>
-                    <Uri>https://rdfepirv2bl3prdstr01.blob.core.windows.net/7d89d439b79f4452950452399add2c90/Microsoft.OSTCLinuxAgent_Test_useast_manifest.xml</Uri>
-                    <Uri>https://rdfepirv2bl3prdstr02.blob.core.windows.net/7d89d439b79f4452950452399add2c90/Microsoft.OSTCLinuxAgent_Test_useast_manifest.xml</Uri>
-                    <Uri>https://rdfepirv2bl3prdstr03.blob.core.windows.net/7d89d439b79f4452950452399add2c90/Microsoft.OSTCLinuxAgent_Test_useast_manifest.xml</Uri>
-                    <Uri>https://zrdfepirv2bl4prdstr01.blob.core.windows.net/7d89d439b79f4452950452399add2c90/Microsoft.OSTCLinuxAgent_Test_useast_manifest.xml</Uri>
-                    <Uri>https://zrdfepirv2bl4prdstr03.blob.core.windows.net/7d89d439b79f4452950452399add2c90/Microsoft.OSTCLinuxAgent_Test_useast_manifest.xml</Uri>
-                    <Uri>https://zrdfepirv2bl5prdstr02.blob.core.windows.net/7d89d439b79f4452950452399add2c90/Microsoft.OSTCLinuxAgent_Test_useast_manifest.xml</Uri>
-                    <Uri>https://zrdfepirv2bl5prdstr04.blob.core.windows.net/7d89d439b79f4452950452399add2c90/Microsoft.OSTCLinuxAgent_Test_useast_manifest.xml</Uri>
-                    <Uri>https://zrdfepirv2bl5prdstr06.blob.core.windows.net/7d89d439b79f4452950452399add2c90/Microsoft.OSTCLinuxAgent_Test_useast_manifest.xml</Uri>
-                    <Uri>https://zrdfepirv2bl5prdstr09a.blob.core.windows.net/7d89d439b79f4452950452399add2c90/Microsoft.OSTCLinuxAgent_Test_useast_manifest.xml</Uri>
-                    <Uri>https://zrdfepirv2bl6prdstr02a.blob.core.windows.net/7d89d439b79f4452950452399add2c90/Microsoft.OSTCLinuxAgent_Test_useast_manifest.xml</Uri>
-                </Uris>
-            </GAFamily>
-        </GAFamilies>
-        <Location>eastus</Location>
-    </GuestAgentExtension>
-    <StatusUploadBlob statusBlobType="BlockBlob">https://walaautoasmeastus.blob.core.windows.net/vhds/walaautos73small.walaautos73small.walaautos73small.status?sr=b&amp;sp=rw&amp;se=9999-01-01&amp;sk=key1&amp;sv=2014-02-14&amp;sig=u%2BCA2Cxb7ticiEBRIW8HWgNW7gl2NPuOGQl0u95ApQE%3D</StatusUploadBlob>
-</Extensions>
diff --git a/tests/ga/test_extension.py b/tests/ga/test_extension.py
index b7e50a30..fe30ca15 100644
--- a/tests/ga/test_extension.py
+++ b/tests/ga/test_extension.py
@@ -286,39 +286,7 @@ class TestExtension(AgentTestCase):
         mock_fileutil.write_file.return_value = IOError("Mock IO Error")
         exthandlers_handler.run()
 
-    def test_handle_ext_handlers_on_hold_true(self, *args):
-        test_data = WireProtocolData(DATA_FILE)
-        exthandlers_handler, protocol = self._create_mock(test_data, *args)
-        exthandlers_handler.ext_handlers, exthandlers_handler.last_etag = protocol.get_ext_handlers()
-        protocol.get_in_vm_artifacts_profile = MagicMock()
-        exthandlers_handler.protocol = protocol
-
-        with patch.object(ExtHandlersHandler, 'handle_ext_handler') as patch_handle_ext_handler:
-            exthandlers_handler.handle_ext_handlers()
-            patch_handle_ext_handler.assert_not_called()
-
-    def test_handle_ext_handlers_on_hold_false(self, *args):
-        test_data = WireProtocolData(DATA_FILE)
-        exthandlers_handler, protocol = self._create_mock(test_data, *args)
-        exthandlers_handler.ext_handlers, exthandlers_handler.last_etag = protocol.get_ext_handlers()
-        exthandlers_handler.protocol = protocol
-
-        #Test when is_extension_handlers_handling_on_hold returns False
-        from azurelinuxagent.common.protocol.wire import InVMArtifactsProfile
-        mock_in_vm_artifacts_profile = InVMArtifactsProfile(MagicMock())
-        mock_in_vm_artifacts_profile.is_extension_handlers_handling_on_hold = Mock(return_value=False)
-        protocol.get_in_vm_artifacts_profile = Mock(return_value=mock_in_vm_artifacts_profile)
-        with patch.object(ExtHandlersHandler, 'handle_ext_handler') as patch_handle_ext_handler:
-            exthandlers_handler.handle_ext_handlers()
-            patch_handle_ext_handler.assert_called_once()
-
-        #Test when in_vm_artifacts_profile is not available
-        protocol.get_in_vm_artifacts_profile = Mock(return_value=None)
-        with patch.object(ExtHandlersHandler, 'handle_ext_handler') as patch_handle_ext_handler:
-            exthandlers_handler.handle_ext_handlers()
-            patch_handle_ext_handler.assert_called_once()
-
-    def _assert_ext_status(self, report_ext_status, expected_status,
+    def _assert_ext_status(self, report_ext_status, expected_status, 
                            expected_seq_no):
         self.assertTrue(report_ext_status.called)
         args, kw = report_ext_status.call_args
diff --git a/tests/ga/test_update.py b/tests/ga/test_update.py
index 3c2d8502..c9c5d1cb 100644
--- a/tests/ga/test_update.py
+++ b/tests/ga/test_update.py
@@ -672,11 +672,11 @@ class TestUpdate(UpdateTestCase):
 
         return self.update_handler._upgrade_available(base_version=base_version)
 
-    def test_upgrade_available_returns_true_on_first_use(self):
+    def test_ensure_latest_agent_returns_true_on_first_use(self):
         self.assertTrue(self._test_upgrade_available())
         return
 
-    def test_get_latest_agent_excluded(self):
+    def test_ensure_current_agent_excluded(self):
         self.prepare_agent(AGENT_VERSION)
         self.assertFalse(self._test_upgrade_available(
                                 versions=self.agent_versions(),
@@ -684,19 +684,7 @@ class TestUpdate(UpdateTestCase):
         self.assertEqual(None, self.update_handler.get_latest_agent())
         return
 
-    def test_upgrade_available_handles_missing_family(self):
-        extensions_config = ExtensionsConfig(load_data("wire/ext_conf_missing_family.xml"))
-        protocol = ProtocolMock()
-        protocol.family = "Prod"
-        protocol.agent_manifests = extensions_config.vmagent_manifests
-        self.update_handler.protocol_util = protocol
-        with patch('azurelinuxagent.common.logger.warn') as mock_logger:
-            with patch('tests.ga.test_update.ProtocolMock.get_vmagent_pkgs', side_effect=ProtocolError):
-                self.assertFalse(self.update_handler._upgrade_available(base_version=CURRENT_VERSION))
-                self.assertEqual(0, mock_logger.call_count)
-        return
-
-    def test_upgrade_available_includes_old_agents(self):
+    def test_ensure_latest_agent_includes_old_agents(self):
         self.prepare_agents()
 
         old_version = self.agent_versions()[-1]
@@ -709,7 +697,7 @@ class TestUpdate(UpdateTestCase):
         self.assertEqual(all_count, len(self.update_handler.agents))
         return
 
-    def test_upgrade_available_purges_old_agents(self):
+    def test_ensure_lastest_agent_purges_old_agents(self):
         self.prepare_agents()
         agent_count = self.agent_count()
         self.assertEqual(5, agent_count)
@@ -720,28 +708,28 @@ class TestUpdate(UpdateTestCase):
         self.assertEqual(agent_versions, self.agent_versions())
         return
 
-    def test_upgrade_available_skips_if_too_frequent(self):
+    def test_ensure_latest_agent_skips_if_too_frequent(self):
         conf.get_autoupdate_frequency = Mock(return_value=10000)
         self.update_handler.last_attempt_time = time.time()
         self.assertFalse(self._test_upgrade_available())
         return
 
-    def test_upgrade_available_skips_if_when_no_new_versions(self):
+    def test_ensure_latest_agent_skips_if_when_no_new_versions(self):
         self.prepare_agents()
         base_version = self.agent_versions()[0] + 1
         self.assertFalse(self._test_upgrade_available(base_version=base_version))
         return
 
-    def test_upgrade_available_skips_when_no_versions(self):
+    def test_ensure_latest_agent_skips_when_no_versions(self):
         self.assertFalse(self._test_upgrade_available(protocol=ProtocolMock()))
         return
 
-    def test_upgrade_available_skips_when_updates_are_disabled(self):
+    def test_ensure_latest_agent_skips_when_updates_are_disabled(self):
         conf.get_autoupdate_enabled = Mock(return_value=False)
         self.assertFalse(self._test_upgrade_available())
         return
 
-    def test_upgrade_available_sorts(self):
+    def test_ensure_latest_agent_sorts(self):
         self.prepare_agents()
         self._test_upgrade_available()
 
diff --git a/tests/protocol/test_hostplugin.py b/tests/protocol/test_hostplugin.py
index ceabd2de..b0a03c52 100644
--- a/tests/protocol/test_hostplugin.py
+++ b/tests/protocol/test_hostplugin.py
@@ -19,7 +19,6 @@ import unittest
 
 import azurelinuxagent.common.protocol.restapi as restapi
 import azurelinuxagent.common.protocol.wire as wire
-import azurelinuxagent.common.protocol.hostplugin as hostplugin
 from tests.protocol.mockwiredata import WireProtocolData, DATA_FILE
 from tests.tools import *
 
@@ -110,9 +109,7 @@ class TestHostPlugin(AgentTestCase):
                            '"BlockBlob"}], ' \
                            '"requestUri": "http://sas_url"}'
 
-        host_client = wire.HostPluginProtocol(wireserver_url,
-                                              test_goal_state.container_id,
-                                              test_goal_state.role_instance_config_name)
+        host_client = wire.HostPluginProtocol(wireserver_url, test_goal_state)
         self.assertFalse(host_client.is_initialized)
         self.assertTrue(host_client.api_versions is None)
         status_blob = wire.StatusBlob(None)
@@ -132,36 +129,6 @@ class TestHostPlugin(AgentTestCase):
                 self.assertTrue(patch_put.call_args[0][1] == expected_content)
                 self.assertTrue(patch_put.call_args[0][2] == expected_headers)
 
-    def test_validate_get_extension_artifacts(self):
-        test_goal_state = wire.GoalState(WireProtocolData(DATA_FILE).goal_state)
-        expected_url = hostplugin.URI_FORMAT_GET_EXTENSION_ARTIFACT.format(wireserver_url, hostplugin.HOST_PLUGIN_PORT)
-        expected_headers = {'x-ms-version': '2015-09-01',
-                            "x-ms-containerid": test_goal_state.container_id,
-                            "x-ms-host-config-name": test_goal_state.role_instance_config_name,
-                            "x-ms-artifact-location": sas_url}
-
-        host_client = wire.HostPluginProtocol(wireserver_url,
-                                              test_goal_state.container_id,
-                                              test_goal_state.role_instance_config_name)
-        self.assertFalse(host_client.is_initialized)
-        self.assertTrue(host_client.api_versions is None)
-
-        with patch.object(wire.HostPluginProtocol, "get_api_versions", return_value=api_versions) as patch_get:
-            actual_url, actual_headers = host_client.get_extension_artifact_url_and_headers(sas_url)
-            self.assertTrue(host_client.is_initialized)
-            self.assertFalse(host_client.api_versions is None)
-            self.assertEqual(expected_url, actual_url)
-            for k in expected_headers:
-                self.assertTrue(k in actual_headers)
-                self.assertEqual(expected_headers[k], actual_headers[k])
-
-class MockResponse:
-    def __init__(self, body, status_code):
-        self.body = body
-        self.status = status_code
-
-    def read(self):
-        return self.body
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/tests/protocol/test_wire.py b/tests/protocol/test_wire.py
index bc2f4964..5a29ebbf 100644
--- a/tests/protocol/test_wire.py
+++ b/tests/protocol/test_wire.py
@@ -106,8 +106,7 @@ class TestWireProtocolGetters(AgentTestCase):
 
         with patch.object(WireClient, "get_goal_state", return_value = goal_state) as patch_get_goal_state:
             host_plugin = wire_protocol_client.get_host_plugin()
-            self.assertEqual(goal_state.container_id, host_plugin.container_id)
-            self.assertEqual(goal_state.role_instance_config_name, host_plugin.role_config_name)
+            self.assertEqual(goal_state, host_plugin.goal_state)
             patch_get_goal_state.assert_called_once()
 
     def test_upload_status_blob_default(self, *args):
@@ -139,82 +138,6 @@ class TestWireProtocolGetters(AgentTestCase):
                 wire_protocol_client.get_goal_state.assert_called_once()
                 patch_host_ga_plugin_upload.assert_called_once_with(wire_protocol_client.status_blob, testurl)
 
-    def test_get_in_vm_artifacts_profile_blob_not_available(self, *args):
-        wire_protocol_client = WireProtocol(wireserver_url).client
-        wire_protocol_client.ext_conf = ExtensionsConfig(None)
-
-        # Test when in_vm_artifacts_profile_blob is null/None
-        self.assertEqual(None, wire_protocol_client.get_in_vm_artifacts_profile())
-
-        #Test when in_vm_artifacts_profile_blob is whitespace
-        wire_protocol_client.ext_conf.in_vm_artifacts_profile_blob = "  "
-        self.assertEqual(None, wire_protocol_client.get_in_vm_artifacts_profile())
-
-    def test_get_in_vm_artifacts_profile_response_body_not_valid(self, *args):
-        wire_protocol_client = WireProtocol(wireserver_url).client
-        wire_protocol_client.ext_conf = ExtensionsConfig(None)
-        wire_protocol_client.ext_conf.in_vm_artifacts_profile_blob = testurl
-        goal_state = GoalState(WireProtocolData(DATA_FILE).goal_state)
-        wire_protocol_client.get_goal_state = Mock(return_value=goal_state)
-
-        with patch.object(HostPluginProtocol, "get_extension_artifact_url_and_headers",
-                          return_value = ['dummy_url', {}]) as host_plugin_get_artifact_url_and_headers:
-            #Test when response body is None
-            wire_protocol_client.call_storage_service = Mock(return_value=MockResponse(None, 200))
-            in_vm_artifacts_profile = wire_protocol_client.get_in_vm_artifacts_profile()
-            self.assertTrue(in_vm_artifacts_profile is None)
-
-            #Test when response body is None
-            wire_protocol_client.call_storage_service = Mock(return_value=MockResponse('   '.encode('utf-8'), 200))
-            in_vm_artifacts_profile = wire_protocol_client.get_in_vm_artifacts_profile()
-            self.assertTrue(in_vm_artifacts_profile is None)
-
-            #Test when response body is None
-            wire_protocol_client.call_storage_service = Mock(return_value=MockResponse('{ }'.encode('utf-8'), 200))
-            in_vm_artifacts_profile = wire_protocol_client.get_in_vm_artifacts_profile()
-            self.assertEqual(dict(), in_vm_artifacts_profile.__dict__,
-                             'If in_vm_artifacts_profile_blob has empty json dictionary, in_vm_artifacts_profile '
-                             'should contain nothing')
-
-            host_plugin_get_artifact_url_and_headers.assert_called_with(testurl)
-
-
-    def test_get_in_vm_artifacts_profile_default(self, *args):
-        wire_protocol_client = WireProtocol(wireserver_url).client
-        wire_protocol_client.ext_conf = ExtensionsConfig(None)
-        wire_protocol_client.ext_conf.in_vm_artifacts_profile_blob = testurl
-        goal_state = GoalState(WireProtocolData(DATA_FILE).goal_state)
-        wire_protocol_client.get_goal_state = Mock(return_value=goal_state)
-
-        wire_protocol_client.call_storage_service = Mock(return_value=MockResponse('{"onHold": "true"}'.encode('utf-8'), 200))
-        in_vm_artifacts_profile = wire_protocol_client.get_in_vm_artifacts_profile()
-        self.assertEqual(dict(onHold='true'), in_vm_artifacts_profile.__dict__)
-        self.assertTrue(in_vm_artifacts_profile.is_extension_handlers_handling_on_hold())
-
-    def test_get_in_vm_artifacts_profile_host_ga_plugin(self, *args):
-        wire_protocol_client = WireProtocol(wireserver_url).client
-        wire_protocol_client.ext_conf = ExtensionsConfig(None)
-        wire_protocol_client.ext_conf.in_vm_artifacts_profile_blob = testurl
-        goal_state = GoalState(WireProtocolData(DATA_FILE).goal_state)
-        wire_protocol_client.get_goal_state = Mock(return_value=goal_state)
-
-        wire_protocol_client._get_in_vm_artifacts_profile = Mock(side_effect=[None, '{"onHold": "true"}'.encode('utf-8')])
-
-        with patch.object(HostPluginProtocol, "get_extension_artifact_url_and_headers",
-                          return_value = ['dummy_url', {}]) as host_plugin_get_artifact_url_and_headers:
-            in_vm_artifacts_profile = wire_protocol_client.get_in_vm_artifacts_profile()
-            self.assertEqual(dict(onHold='true'), in_vm_artifacts_profile.__dict__)
-            self.assertTrue(in_vm_artifacts_profile.is_extension_handlers_handling_on_hold())
-            host_plugin_get_artifact_url_and_headers.assert_called_once_with(testurl)
-
-
-class MockResponse:
-    def __init__(self, body, status_code):
-        self.body = body
-        self.status = status_code
-
-    def read(self):
-        return self.body
 
 if __name__ == '__main__':
     unittest.main()