1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# Backported from
# http://lists.xensource.com/archives/html/xen-changelog/2006-04/msg00087.html
--- tools/python/xen/xm/create.py 2006-07-22 12:50:35.000000000 +1000
+++ tools/python/xen/xm/create.py 2006-07-22 12:52:52.000000000 +1000
@@ -850,6 +850,16 @@
opts.info("Started domain %s" % (dom))
return int(sxp.child_value(dominfo, 'domid'))
+def get_xauthority():
+ xauth = os.getenv("XAUTHORITY")
+ if not xauth:
+ home = os.getenv("HOME")
+ if not home:
+ import posix, pwd
+ home = pwd.getpwuid(posix.getuid())[5]
+ xauth = home + "/.Xauthority"
+ return xauth
+
def parseCommandLine(argv):
gopts.reset()
args = gopts.parse(argv)
@@ -864,14 +874,7 @@
gopts.vals.display = os.getenv("DISPLAY")
if not gopts.vals.xauthority:
- xauth = os.getenv("XAUTHORITY")
- if not xauth:
- home = os.getenv("HOME")
- if not home:
- import posix, pwd
- home = pwd.getpwuid(posix.getuid())[5]
- xauth = home + "/.Xauthority"
- gopts.vals.xauthority = xauth
+ gopts.vals.xauthority = get_xauthority()
# Process remaining args as config variables.
for arg in args:
--- tools/python/xen/xm/tests/test_create.py 2006-07-22 12:59:13.000000000 +1000
+++ tools/python/xen/xm/tests/test_create.py 2006-07-22 12:59:13.000000000 +1000
@@ -51,6 +51,7 @@
'path' : '.:/etc/xen',
'builder' : 'linux',
'nics' : -1,
+ 'xauthority': xen.xm.create.get_xauthority(),
})
@@ -99,6 +100,7 @@
'interface' : 'eth0',
'path' : '.:/etc/xen',
'builder' : 'linux',
+ 'xauthority': xen.xm.create.get_xauthority(),
})
@@ -138,6 +140,7 @@
'path' : '.:/etc/xen',
'builder' : 'linux',
'nics' : -1,
+ 'xauthority': xen.xm.create.get_xauthority(),
})
@@ -188,6 +191,7 @@
'dhcp' : 'off',
'interface' : 'eth0',
'path' : '.:/etc/xen',
+ 'xauthority': xen.xm.create.get_xauthority(),
})
|