diff options
author | Claudiu Belu <cbelu@cloudbasesolutions.com> | 2017-02-02 19:12:42 +0200 |
---|---|---|
committer | Claudiu Belu <cbelu@cloudbasesolutions.com> | 2017-02-23 16:46:50 +0000 |
commit | 847c28abcfe508c7b63f5b9bc78cbc8962a2c8b7 (patch) | |
tree | 6979d834ee47c426184f6774aff3aae5d75f3746 | |
parent | 458d79b61abb1a9ad36ce4868cf248ddb21c80a7 (diff) | |
download | oslo-rootwrap-847c28abcfe508c7b63f5b9bc78cbc8962a2c8b7.tar.gz |
Avoid importing Linux specific modules on Windows
oslo.rootwrap currently imports a few Linux-specific modules, which
means that any services importing oslo.rootwrap modules will fail to
start on Windows (e.g.: neutron-ovs-agent).
Change-Id: I229c311939facdffdcde484f590e980102024b5a
Closes-Bug: #1661326
-rw-r--r-- | oslo_rootwrap/filters.py | 7 | ||||
-rw-r--r-- | oslo_rootwrap/wrapper.py | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/oslo_rootwrap/filters.py b/oslo_rootwrap/filters.py index 1ae2cde..3c93d42 100644 --- a/oslo_rootwrap/filters.py +++ b/oslo_rootwrap/filters.py @@ -14,9 +14,14 @@ # under the License. import os -import pwd import re import shutil +import sys + +if sys.platform != 'win32': + # NOTE(claudiub): pwd is a Linux-specific library, and currently there is + # no Windows support for oslo.rootwrap. + import pwd def _getuid(user): diff --git a/oslo_rootwrap/wrapper.py b/oslo_rootwrap/wrapper.py index 998beae..49fdac3 100644 --- a/oslo_rootwrap/wrapper.py +++ b/oslo_rootwrap/wrapper.py @@ -16,8 +16,11 @@ import logging import logging.handlers import os -import pwd import signal +import sys + +if sys.platform != 'win32': + import pwd import six from six import moves |