Internal method: configure a *single* parameter results: dict of results to update method: config method name param: arg=value (ignore if value=None) value may also be list or dict
( self, results, method, **param )
| 587 | # annoying, but at least the information is there! |
| 588 | |
| 589 | def setParam( self, results, method, **param ): |
| 590 | """Internal method: configure a *single* parameter |
| 591 | results: dict of results to update |
| 592 | method: config method name |
| 593 | param: arg=value (ignore if value=None) |
| 594 | value may also be list or dict""" |
| 595 | name, value = list( param.items() )[ 0 ] |
| 596 | if value is None: |
| 597 | return None |
| 598 | f = getattr( self, method, None ) |
| 599 | if not f: |
| 600 | return None |
| 601 | if isinstance( value, list ): |
| 602 | result = f( *value ) |
| 603 | elif isinstance( value, dict ): |
| 604 | result = f( **value ) |
| 605 | else: |
| 606 | result = f( value ) |
| 607 | results[ name ] = result |
| 608 | return result |
| 609 | |
| 610 | def config( self, mac=None, ip=None, |
| 611 | defaultRoute=None, lo='up', **_params ): |