Skip to content

Can't parse files without ports in status.log #16

@stemenn

Description

@stemenn

I have an openvpn-status.log like that one:

OpenVPN CLIENT LIST
Updated,Tue Mar 31 12:14:41 2020
Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since
s4-mini,xxx.xxx.xxx.xxx,3747660,15781519,Tue Mar 31 04:33:44 2020
ROUTING TABLE
Virtual Address,Common Name,Real Address,Last Ref
fd8b:ed45::1:10,s4-mini,xxx.xxx.xxx.xxx,Tue Mar 31 12:12:50 2020
10.8.1.10,s4-mini,xxx.xxx.xxx.xxx,Tue Mar 31 12:17:10 2020
GLOBAL STATS
Max bcast/mcast queue length,0
END

So there is no port given in the file. The xxx.xxx.xxx.xxx is most times an ipv4, but it can also be an ipv6.

When I try to parse the file with the parse, I get this error message:

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/openvpn_status/descriptors.py", line 31, in __set__
value = self.input_type(value)
File "/usr/local/lib/python3.6/dist-packages/openvpn_status/utils.py", line 29, in parse_peer
host, port = peer.rsplit(':', 1)
ValueError: not enough values to unpack (expected 2, got 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/openvpn_status/parser.py", line 84, in parse
return self._parse()
File "/usr/local/lib/python3.6/dist-packages/openvpn_status/parser.py", line 98, in _parse
for c in self._parse_fields(Client, Status.routing_table.label)})
File "/usr/local/lib/python3.6/dist-packages/openvpn_status/parser.py", line 96, in
status.client_list.update({
File "/usr/local/lib/python3.6/dist-packages/openvpn_status/parser.py", line 132, in _parse_fields
setattr(instance, name, value)
File "/usr/local/lib/python3.6/dist-packages/openvpn_status/descriptors.py", line 33, in __set__
raise AssignmentValueError(e)
openvpn_status.descriptors.AssignmentValueError: not enough values to unpack (expected 2, got 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.6/dist-packages/openvpn_status/shortcuts.py", line 18, in parse_status
return parser.parse()
File "/usr/local/lib/python3.6/dist-packages/openvpn_status/parser.py", line 89, in parse
raise ParsingError('expected valid format: %s' % msg)
openvpn_status.parser.ParsingError: expected valid format: not enough values to unpack (expected 2, got 1)

It seems that there has to be an port in the file, but my Server ist not writing one into it.
I am using Openvpn 2.4.4 on Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions