From: Eren Yagdiran <erenyagdiran(a)gmail.com>
Define some constants to refer to the default image and
template storage directories
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
libvirt-sandbox/image/cli.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libvirt-sandbox/image/cli.py b/libvirt-sandbox/image/cli.py
index 3bf7d58..de34321 100755
--- a/libvirt-sandbox/image/cli.py
+++ b/libvirt-sandbox/image/cli.py
@@ -32,6 +32,16 @@ import sys
import urllib2
import subprocess
+if os.geteuid() == 0:
+ default_template_dir = "/var/lib/libvirt/templates"
+ default_image_dir = "/var/lib/libvirt/images"
+else:
+ default_template_dir = os.environ['HOME'] +
"/.local/share/libvirt/templates"
+ default_image_dir = os.environ['HOME'] +
"/.local/share/libvirt/images"
+
+debug = False
+verbose = False
+
import importlib
def dynamic_source_loader(name):
name = name[0].upper() + name[1:]
--
2.4.3