Hi guys,
I come a across a tricky issue developing wsadmin code for websphere. No matter what file I choose, os.stat() seems always to give me back a uid = 0. See the following files:
-rw-r--r-- 1 tn58660 other 1625 Apr 26 15:03 search.py
-rw-r--r-- 1 wasapps wasapp 109 Mar 22 17:27 test.py
bash-3.00# /export/opt/WebSphere/70/bin/wsadmin.sh -lang jython
WASX7031I: For help, enter: "print Help.help()"
wsadmin>import os
wsadmin>stat_info = os.stat('search.py')
wsadmin>print stat_info
(0, 0, 0, 0, 0, 0, 1625L, 1.272265415E9, 1.272265415E9, 0)
wsadmin>stat_info = os.stat('test.py')
wsadmin>print stat_info
(0, 0, 0, 0, 0, 0, 109L, 1.269250059E9, 1.269250059E9, 0)
The 5th item in the tuple is the UID which as you can see is showing up as 0 for both files. I've tested jython 2.5.1 directly and I get better results:
>>> stat_info = os.stat('../test.py')
>>> print stat_info
(33188, 88416L, 67174403L, 1, 1000646, 301350, 109L, 1272250212L, 1269250059L, 1272528356L)
>>> stat_info = os.stat('../search.py')
>>> print stat_info
(33188, 173427L, 67174403L, 1, 1000644, 1, 1625L, 1272265494L, 1272265415L, 1272358668L)
So it definitely appears to be a jython 2.1 problem. Now the question is how to fix it. I don;t want to upgrade jython under the covers of wsadmin in case it breaks something else. I suppose the only other option is to make a direct call out to the os to get the uid and parse the results string.
Anyone have any other ideas ?
cheers,
Trevor