On 08/09/11 16:01, Virginia Wray wrote:
Hi Ethan --

To follow up on your second comment.....



On 08/ 9/11 02:41 PM, Ethan Quach wrote:
Hi Ginnie,

I don't think this will address 7066541. You'll need to wrap the os.mkdir() call around a try, like the following:

import errno

[...]

299         if not os.path.exists(logdir):
                 try:
                     os.mkdir(logdir)
                 except OSError as err:
                     if err.errno != errno.EEXISTS:
                         raise


logger.py - 270 - Why not just define this with default_log=DEFAULTLOG, which would simply lines 292 - 297 to back to:

              logdir = os.path.dirname(self.default_log_file)


I tried this, but if the passed in value is None, it appears to override the DEFAULTLOG value.

I ended up with this:
-> def __init__(self, name, default_log=DEFAULTLOG, level=None):
-> self.default_log_file = default_log
(Pdb) print default_log
None
(Pdb) print DEFAULTLOG
/var/tmp/install/default_log.8324
(Pdb) n
> /data/share/vw130254/projectwork/logging_bugs/slim_source/proto/root_i386/usr/lib/python2.6/vendor-packages/solaris_install/logger.py(276)__init__()
-> if level is None:
(Pdb) print self.default_log_file


and it ends up failing because it tries to create a log file using None.

If so, do you have any suggestions as to what I'm doing wrong?

I don't think you're doing anything wrong. But the user would actually have explicitly pass in a value of default_log=None for this to happen, which the installers shouldn't be doing right?

As with any other arguments, if the underlying function code needs to handle certain values specially, the code should handle it. In this particular case, if default_log isn't allowed to be None, you just need to check for the value of None and set it accordingly, as with any other options argument validation. e.g.


def __init__(self, name, default_log=DEFAULTLOG, level=None):

    self.default_log_file = default_log

    if self.default_log_file is None:
        self.default_log_file = DEFAULTLOG


Of course, if you do this, then its sort of irrelevant how you define the __init__() fuction; it could be left as default_log=None, but it just seems strange to set that if you know that's not allowed.


-ethan


thanks,
ginnie


-ethan


On 08/09/11 12:43, Virginia Wray wrote:
Hi --

Could I get a code review for the following bug:
http://monaco.us.oracle.com/detail.jsf?cr=7033339
Be able to specify logfile name when instantiate InstallLogger

https://cr.opensolaris.org/action/browse/caiman/ginnie/7033339/webrev/


I've tested the changes with the distro constructor. I ran it in its original
form and it completed successfully. I also modified it to set it's own
default log using my code changes and ran it. I checked to make sure
the engine interface worked correctly with these changes as well.
In both instances, it logged to the location that I expected.

I've included instructions on how to invoke this in the logger.py file.

I've asked Karen and Drew to review. Others are welcome as well.
I'm leaving on vacation, so if you could respond today, I would
appreciate it.

thanks,
ginnie


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

Reply via email to