Fix Windows support

With a single line change, we can use this cinder client extension
on Windows. This patch will avoid the os.getuid call, which is
unavailable on Windows.

Note that on Windows, we aren't doing any privilege escalation,
assuming that we already have the required rights.

Here's a sample: http://paste.openstack.org/raw/802466/

Change-Id: Ic554b5df2adee38b97665c578ca69b33c8694ca7
This commit is contained in:
Lucian Petrut 2021-02-09 13:22:59 +02:00
parent 0259467434
commit 26495b75bb
3 changed files with 6 additions and 2 deletions

View File

@ -30,7 +30,7 @@ Optional dependencies based on Cinder driver's protocol::
* open-iscsi, udev - for volume attachment via iSCSI
NOTE (e0ne): current version is tested only on Linux hosts
NOTE (e0ne): current version is tested on Linux and Windows hosts
For any other information, refer to the parent projects, Cinder and
python-cinderclient::

View File

@ -62,7 +62,7 @@ def get_root_helper():
def require_root(f):
def wrapper(*args, **kwargs):
if os.getuid() != 0:
if hasattr(os, 'getuid') and os.getuid() != 0:
raise exceptions.CommandError(
"This command requires root permissions.")
return f(*args, **kwargs)

View File

@ -0,0 +1,4 @@
---
features:
- |
Added Windows support.