Karen,
Great question. The fd is an int so I can not use the with syntax.
>>> with os.open("/tmp/funny", os.O_RDONLY) as fd:
... os.chown(fd, 0, 0)
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'int' object has no attribute '__exit__'
I can not use open() instead of os.open() because python complains
that I am dealing with a directory:
>>> open("/tmp/funny", "r")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: [Errno 21] Is a directory: '/tmp/funny'
>>> open("/tmp/funny", "w")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: [Errno 21] Is a directory: '/tmp/funny'
Thus I used the os.open()/os.close(fd) instead.
Thanks,
John
On 09/ 9/11 03:29 PM, Karen Tung wrote:
Hi John,
The os.close(fd) call in line 126 doesn't happen if we hit the
exception in line 124.
It's better to change line 117 to:
with os.open(imagepath, os.O_RDONLY) as fd:
.....
That way, you don't need to worry about managing "fd".
Thanks,
--Karen
On 09/ 9/11 03:12 PM, John Fischer wrote:
All,
Can I get a couple of folks to look at the webrev for CR 7014125:
http://monaco.us.oracle.com/detail.jsf?cr=7014125
7014125 "installadm create-service -s <src_image> <000
directory>" should fail
It is located at:
https://cr.opensolaris.org/action/browse/caiman/johnfisc/7014125/
Essentially, the installadm create-service would succeed regardless
of the
permissions of the image directory but the webserver might fail if
the permissions
were not correct. The solution is to simply set the ownership and
permissions
of the directory to webservd and 770 after the image has been copied
to the
image directory.
I have tested this via installadm create-service with an image
directory that was
owned by someone other then webservd and had 000 permissions. The
additional
code is pep8 clean.
Thanks,
John
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss