You can't use a context manager for low-level opens out of the os module. Only with the open() built-in.

-Drew

On 9/12/11 7:25 AM, Darren Kenny wrote:
Hi Dew,

I'm surprised to not see you using a with statement... ;)

Is there a specific reason that you didn't - this would remove the need to add a
specific .close() call.

Darren.

On 12/09/2011 14:09, Drew Fisher wrote:
Round 2:

https://cr.opensolaris.org/action/browse/caiman/drewfish/7088855_2/webrev/

I tested opening a bad path on my own system, outside of target discovery:

fd = os.open("/dev/rdsk/c4t0d0s1", os.O_RDONLY | os.O_NDELAY)
fd
3
os.read(fd, 512)
Traceback (most recent call last):
   File "<stdin>", line 1, in<module>
OSError: [Errno 5] I/O error

python doesn't care if the path doesn't exist (I don't have any disks with c4),
just when we try to read from it.

I've also added the finally clause to close the file descriptor.

Thanks!

-Drew


On 9/9/11 8:02 PM, Drew Fisher wrote:
Good evening!

Could I please get a code review for a fairly simple CR:

7088855<http://monaco.us.oracle.com/detail.jsf?cr=7088855>  bad drive leads to
failed auto-install assertion

https://cr.opensolaris.org/action/browse/caiman/drewfish/7088855/webrev/

I ran the target unittests and saw no new regressions.  I also tested on
Mike's machine (where the problem originally presented itself).  We now
properly skip the broken drive.

We have to do the check where it is, because for failing / failed / broken
drives, accessing the media attributes actually causes the failure so we have
to do this first.

Thanks!

-Drew


_______________________________________________
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
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss

Reply via email to