From 2e9de6868bcd9b2906ca761731f46ec5919c04b0 Mon Sep 17 00:00:00 2001
From: Alexander Chadin <aschadin@sbcloud.ru>
Date: Fri, 12 Oct 2018 17:36:17 +0300
Subject: [PATCH] Prepare watcherclient for microversioning

Implements: blueprint bp/api-microversioning

Change-Id: I049f9aac84a5658efaccc9e9fdf6c9d4be677d29
---
 .gitignore                         |  3 +++
 watcherclient/common/httpclient.py | 16 ++--------------
 2 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/.gitignore b/.gitignore
index 7052a54..5a6a636 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,3 +59,6 @@ sftp-config.json
 
 # Desktop Service Store
 *.DS_Store
+
+# Atom
+.remote-sync.json
diff --git a/watcherclient/common/httpclient.py b/watcherclient/common/httpclient.py
index 36a8469..a4e2f1b 100644
--- a/watcherclient/common/httpclient.py
+++ b/watcherclient/common/httpclient.py
@@ -42,7 +42,7 @@ from watcherclient import exceptions
 #             microversion support in the client properly! See
 #             http://specs.openstack.org/openstack/watcher-specs/specs/kilo/api-microversions.html # noqa
 #             for full details.
-DEFAULT_VER = '1.0'
+DEFAULT_VER = 'latest'
 
 
 LOG = logging.getLogger(__name__)
@@ -104,20 +104,8 @@ class VersionNegotiationMixin(object):
                 {'valid': ', '.join(API_VERSION_SELECTED_STATES),
                  'value': self.api_version_select_state})
         min_ver, max_ver = self._parse_version_headers(resp)
-        # NOTE: servers before commit 32fb6e99 did not return version headers
-        # on error, so we need to perform a GET to determine
-        # the supported version range
-        if not max_ver:
-            LOG.debug('No version header in response, requesting from server')
-            if self.os_watcher_api_version:
-                base_version = ("/v%s" %
-                                str(self.os_watcher_api_version).split('.')[0])
-            else:
-                base_version = API_VERSION
-            resp = self._make_simple_request(conn, 'GET', base_version)
-            min_ver, max_ver = self._parse_version_headers(resp)
         # If the user requested an explicit version or we have negotiated a
-        # version and still failing then error now.  The server could
+        # version and still failing then error now. The server could
         # support the version requested but the requested operation may not
         # be supported by the requested version.
         if self.api_version_select_state == 'user':