From Dan Kenigsberg danken@redhat.com:
Dan Kenigsberg has uploaded a new change for review.
Change subject: use os.path.join with P_VDSM_RUN ......................................................................
use os.path.join with P_VDSM_RUN
In three places the code assumes that P_VDSM_RUN ends with a slash. Using os.path.join makes the code a bit more robust to common slash forgetfulness. This makes it possible to make a couple of tests slightly less ugly.
Change-Id: I51b14fca58345430a8556301b781e9f55713a55b Signed-off-by: Dan Kenigsberg danken@redhat.com --- M lib/vdsm/constants.py.in M lib/vdsm/network/dhclient_monitor.py M lib/vdsm/network/ifacetracking.py M tests/vm_test.py M tests/vmfakelib.py M tests/vmrecovery_test.py 6 files changed, 8 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/13/70313/1
diff --git a/lib/vdsm/constants.py.in b/lib/vdsm/constants.py.in index 44a36b9..e109bc6 100644 --- a/lib/vdsm/constants.py.in +++ b/lib/vdsm/constants.py.in @@ -80,7 +80,7 @@ P_VDSM_HOOKS = '@HOOKSDIR@/' # NOQA: E501 (potentially long line) P_VDSM_LIB = '@VDSMLIBDIR@/' # NOQA: E501 (potentially long line) P_VDSM_RUN = '@VDSMRUNDIR@/' # NOQA: E501 (potentially long line) -P_VDSM_STORAGE = P_VDSM_RUN + 'storage/' +P_VDSM_STORAGE = os.path.join(P_VDSM_RUN, 'storage/') P_VDSM_CONF = '@CONFDIR@/' # NOQA: E501 (potentially long line) P_VDSM_KEYS = '/etc/pki/vdsm/keys/' P_VDSM_CERT = '/etc/pki/vdsm/certs/vdsmcert.pem' diff --git a/lib/vdsm/network/dhclient_monitor.py b/lib/vdsm/network/dhclient_monitor.py index 4a86960..4e7944e 100644 --- a/lib/vdsm/network/dhclient_monitor.py +++ b/lib/vdsm/network/dhclient_monitor.py @@ -41,7 +41,7 @@ IFACE_KEY = 'iface'
-MONITOR_FOLDER = P_VDSM_RUN + 'sourceRoutes' +MONITOR_FOLDER = os.path.join(P_VDSM_RUN, 'sourceRoutes')
def start(): diff --git a/lib/vdsm/network/ifacetracking.py b/lib/vdsm/network/ifacetracking.py index ffa3071..d1142b2 100644 --- a/lib/vdsm/network/ifacetracking.py +++ b/lib/vdsm/network/ifacetracking.py @@ -25,7 +25,7 @@ from vdsm.utils import rmFile
-TRACKED_INTERFACES_FOLDER = P_VDSM_RUN + 'trackedInterfaces' +TRACKED_INTERFACES_FOLDER = os.path.join(P_VDSM_RUN, 'trackedInterfaces')
def add(device_name): diff --git a/tests/vm_test.py b/tests/vm_test.py index c7324cf..b0b2ff5 100644 --- a/tests/vm_test.py +++ b/tests/vm_test.py @@ -106,7 +106,7 @@
def assertBuildCmdLine(self, confToDom): with namedTemporaryDir() as tmpDir: - with MonkeyPatchScope([(constants, 'P_VDSM_RUN', tmpDir + '/')]): + with MonkeyPatchScope([(constants, 'P_VDSM_RUN', tmpDir)]): for conf, expectedXML in confToDom:
expectedXML = expectedXML % conf diff --git a/tests/vmfakelib.py b/tests/vmfakelib.py index c240c19..5a5e630 100644 --- a/tests/vmfakelib.py +++ b/tests/vmfakelib.py @@ -240,7 +240,7 @@ cif=None, create_device_objects=False, post_copy=None): with namedTemporaryDir() as tmpDir: - with MonkeyPatchScope([(constants, 'P_VDSM_RUN', tmpDir + '/'), + with MonkeyPatchScope([(constants, 'P_VDSM_RUN', tmpDir), (libvirtconnection, 'get', Connection), (containersconnection, 'get', Connection), (vm.Vm, 'send_status_event', diff --git a/tests/vmrecovery_test.py b/tests/vmrecovery_test.py index 2c8cc15..d69c872 100644 --- a/tests/vmrecovery_test.py +++ b/tests/vmrecovery_test.py @@ -140,7 +140,7 @@ @contextlib.contextmanager def setup_env(self): with fake.VM() as testvm, namedTemporaryDir() as tmpdir: - with MonkeyPatchScope([(constants, 'P_VDSM_RUN', tmpdir + '/')]): + with MonkeyPatchScope([(constants, 'P_VDSM_RUN', tmpdir)]): yield testvm, tmpdir
@@ -188,7 +188,7 @@ def test_clean_vm_files(self):
with fake.VM() as testvm, namedTemporaryDir() as tmpdir: - with MonkeyPatchScope([(constants, 'P_VDSM_RUN', tmpdir + '/')]): + with MonkeyPatchScope([(constants, 'P_VDSM_RUN', tmpdir)]): stored = recovery.File(testvm.id) stored.save(testvm)
@@ -212,7 +212,7 @@
with namedTemporaryDir() as tmpdir: with MonkeyPatchScope([ - (constants, 'P_VDSM_RUN', tmpdir + '/'), + (constants, 'P_VDSM_RUN', tmpdir), (recovery, '_list_domains', lambda: []), (containersconnection, 'recovery', lambda: []), ]):
From Dan Kenigsberg danken@redhat.com:
Dan Kenigsberg has posted comments on this change.
Change subject: use os.path.join with P_VDSM_RUN ......................................................................
Patch Set 3:
(1 comment)
https://gerrit.ovirt.org/#/c/70313/2/lib/vdsm/network/dhclient_monitor.py File lib/vdsm/network/dhclient_monitor.py:
PS2, Line 35: dhclientmon'
Should not have changed
thanks for saving me
From Dan Kenigsberg danken@redhat.com:
Dan Kenigsberg has posted comments on this change.
Change subject: use os.path.join with P_VDSM_RUN ......................................................................
Patch Set 4: Code-Review+2 Verified+1
http://jenkins.ovirt.org/job/vdsm_master_check-merged-el7-x86_64/1228/change...
From Dan Kenigsberg danken@redhat.com:
Dan Kenigsberg has submitted this change and it was merged.
Change subject: use os.path.join with P_VDSM_RUN ......................................................................
use os.path.join with P_VDSM_RUN
In three places the code assumes that P_VDSM_RUN ends with a slash. Using os.path.join makes the code a bit more robust to common slash forgetfulness. This makes it possible to make a couple of tests slightly less ugly.
Change-Id: I51b14fca58345430a8556301b781e9f55713a55b Signed-off-by: Dan Kenigsberg danken@redhat.com --- M lib/vdsm/constants.py.in M lib/vdsm/network/dhclient_monitor.py M lib/vdsm/network/ifacetracking.py M tests/vm_test.py M tests/vmfakelib.py M tests/vmrecovery_test.py 6 files changed, 8 insertions(+), 8 deletions(-)
Approvals: Jenkins CI: Passed CI tests Dan Kenigsberg: Verified; Looks good to me, approved Edward Haas: Looks good to me, but someone else must approve
vdsm-patches@lists.fedorahosted.org