| Total Complexity | 3 |
| Total Lines | 20 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | # Licensed to the StackStorm, Inc ('StackStorm') under one or more |
||
| 19 | class IsValidNameifAction(Action): |
||
| 20 | def run(self, nameif): |
||
| 21 | """ |
||
| 22 | Checks if nameif is valid for use on a Cisco ASA as an interface name. |
||
| 23 | |||
| 24 | args: |
||
| 25 | - nameif: The name |
||
| 26 | |||
| 27 | raises: |
||
| 28 | - ValueError: On an invalid nameif. |
||
| 29 | |||
| 30 | returns: |
||
| 31 | - True: If the name is valid. |
||
| 32 | """ |
||
| 33 | if len(nameif) > 48: |
||
| 34 | raise ValueError("nameif too long: {} > 48".format(len(nameif))) |
||
| 35 | elif " " in nameif: |
||
| 36 | raise ValueError("nameif should contain spaces.") |
||
| 37 | |||
| 38 | return True |
||
| 39 |