Kami commented on code in PR #1676:
URL: https://github.com/apache/libcloud/pull/1676#discussion_r845955706


##########
libcloud/common/openstack.py:
##########
@@ -343,9 +343,22 @@ def add_default_headers(self, headers):
         headers[AUTH_TOKEN_HEADER] = self.auth_token
         headers["Accept"] = self.accept_format
         if self._ex_force_microversion:
-            headers["OpenStack-API-Version"] = (
-                "compute %s" % self._ex_force_microversion
-            )
+            # If service not set in microversion, asume compute
+            microversion = self._ex_force_microversion.strip().split()
+            if len(microversion) == 2:
+                service_type = microversion[0]
+                microversion = microversion[1]
+            elif len(microversion) == 1:
+                service_type = "compute"
+                microversion = microversion[0]
+            else:
+                raise LibcloudError("Invalid microversion format.")

Review Comment:
   Would be good to include expected / valid format in the error message.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to