Bug 5944 - pkgsend traceback if invalid or no action type specified
: pkgsend traceback if invalid or no action type specified
Status: RESOLVED FIXINSOURCE
Product: pkg
pkgsend
: in101 (8c6d0d1315cc)
: ANY/Generic All
: P4 minor (vote)
: ---
Assigned To: Shawn Walker
: pkg/pkgsend watcher
:
:
:
:
:
  Show dependency treegraph
 
Reported: 2008-12-22 14:21 UTC by Tom Mueller
Modified: 2009-02-13 12:08 UTC (History)
0 users (show)

See Also:


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description Tom Mueller 2008-12-22 14:21:05 UTC
If pkgsend is run without an action type after the "add" you get a traceback. 

For example (note the "file" type is missing after the "add"):

$ pkgsend add ~/foo.txt mode=0777 user=bin group=bin path=foo/foo.txt
Traceback (most recent call last):
  File "/home/trm/pkg-toolkit/pkg/bin/publish.py", line 350, in ?
    ret = main_func()
  File "/home/trm/pkg-toolkit/pkg/bin/publish.py", line 323, in main_func
    trans_add(pcfg, pargs)
  File "/home/trm/pkg-toolkit/pkg/bin/publish.py", line 169, in trans_add
    action = pkg.actions.fromlist(args[0], args[1:])
  File "/home/trm/pkg-toolkit/pkg/vendor-packages/pkg/actions/__init__.py",
line 171, in fromlist
    action = types[type](**attrs)
KeyError: '/home/trm/foo.txt'

Suggested fix: If an invalid action type is specified after the add, a usage
message should be printed.
Comment 1 Shawn Walker 2009-02-03 23:34:53 UTC
Just need action to check the action type in fromlist and have pkgsend catch
any relevant exceptions gracefully.
Comment 2 Shawn Walker 2009-02-04 00:11:58 UTC
Will now print something like:

pkgsend: Unknown action type '/export/home/xxx/foo.txt' in action
'/export/home/xxx/foo.txt mode=0777 user=bin group=bin path=foo/foo.txt'
Comment 3 Shawn Walker 2009-02-13 12:08:53 UTC
Fixed in changeset 873 / b95d76c53b5eeece7335982e3ccf7047770decc4.