amoffat/pbs — Issue #32: pbs options can be mis-spelled and passed to the program blindly
Author: pcn
Created: 2012-02-05 17:27:16+00:00
State: open

```python
>>> import pbs
>>>
>>> pbs.ifconfig("eth0", "_bh")
Traceback (most recent call last):
File "", line 1, in
File "/Users/pn/dvcs/pbs/pbs.py", line 520, in __call__
if rc != 0: raise get_rc_exc(rc)(self._command_ran, self.stdout, self.stderr)
pbs.ErrorReturnCode_1:

Ran: '/sbin/ifconfig en0 _bh'

STDOUT:

STDERR:

ifconfig: _bh: bad value
```
So this results in an error from ifconfig, but not from pbs. I think it'd be worth it to make it possible to add a class "pbs.opt" to pass in options:

```python
>>> import pbs
>>> from pbs import opt
>>>
>>> pbs.ifconfig("eth0", opt('bh'))
```
and at this point, an exception can be raised. pbs.opt would have a strict list of options that could be passed in, and the right error is returned.

It doesn't need to obviate the current simple mechanism, but provides some extra safety and feedback to the user.