Folks,

Per the latest webrev, for license action when hash attribute is missing the
following error would be printed.

   pkgsend: invalid action, 'license NOHASH license=copyright': Empty
   or invalid path attribute

I had offline conversation with Shawn about this error message and it is
acceptable to him. Please let me know your opinion about this error message.

Thanks,
Abhi.

On 09/14/12 16:16, Abhinandan Ekande wrote:
Shawn,

On 09/13/12 23:18, Shawn Walker wrote:
src/modules/actions/__init__.py:

  lines 348-352:  In general, when writing things in Python, the
    preferred approach is to "leap first, then look".  That is,
    don't check for a key or value, simply perform the action and
    catch the exception raised and handle it.  In addition, the
    exception raised here assumes that because there is no "path"
    that this is a license action.  That's not necessarily true.


Thanks for the feedback.

    So instead of:

    if "path" in action.attrs and payload == "NOHASH":
        filepath = os.path.sep + action.attrs["path"]
    elif "path" not in action.attrs and payload == "NOHASH":
        raise ActionDataError(_("Hash attribute is missing "
            "for license action"))

    ...I'd try this:

    if payload == "NOHASH":
        try:
            filepath = os.path.sep + action.attrs["path"]
        except KeyError:
            raise InvalidPathAttributeError(action)


I followed the above approach. Here is updated webrev :
https://cr.opensolaris.org/action/browse/pkg/ae112802/7139743-rev2/webrev/


src/modules/publish/dependencies.py:
  I don't think this change is needed if you do the above.

Yes, not needed with new approach.

Abhi.


We may need to tweak this, so can you try that and see what you get?

-Shawn
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to