forked fromalphagov/fabric-scripts
- Notifications
You must be signed in to change notification settings - Fork0
Commita19c780
committed
Fix host splitting
The second parameter to `str.split()` is the maximum number of splitsto do, which means the list will have at most that many plus oneelements.For strings which have more than 2 dots this causes an unintendedValueError.For example:```>>> host, vdc, _ = 'host-1.vdc.env'.split('.', 3)>>> host, vdc, _ = 'host-1.vdc.env.computers.gov.uk'.split('.', 3)Traceback (most recent call last): File "<stdin>", line 1, in <module>ValueError: too many values to unpack>>> host, vdc, _ = 'host-1.vdc.env.computers.gov.uk'.split('.', 2)```1 parent58ca6cb commita19c780
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
0 commit comments
Comments
(0)