1 | initial version |
Hi avladu,
thanks for your help. I did as advised. Still the same error. Even worse, I can't get it to work even completely isolated:
$ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> debian_network_conf="""
... iface eth0 inet static
... address 192.168.1.90
... netmask 255.255.255.0
... broadcast 192.168.1.255
... gateway 192.168.1.254
... dns-nameserver 8.8.8.8
...
... """
>>> m = re.search(r'iface eth0 inet static\s+'
... r'address\s+(?P<address>[^\s]+)\s+'
... r'netmask\s+(?P<netmask>[^\s]+)\s+'
... r'broadcast\s+(?P<broadcast>[^\s]+)\s+'
... r'gateway\s+(?P<gateway>[^\s]+)\s+'
... r'dns\-nameservers\s+(?P<dnsnameservers>[^\r\n]+)\s+',
... debian_network_conf)
>>>
>>>
whereas, without concatenating the regexp I can get matches
>>> re.search(r'iface eth0 inet static\s+',debian_network_conf)
<_sre.SRE_Match object at 0x10ce798b8>
>>> re.search(r'address\s+(?P<address>[^\s]+)\s+',debian_network_conf)
<_sre.SRE_Match object at 0x10ce78990>
So, what am I doing wrong?
Thanks in advance, Florian
2 | No.2 Revision |
UPDATE / solved
Hi avladu,
thanks. You putted me in the right direction! I was missing "s"
at the end of dns-nameserver
. So this is info is evaluated properly:
cat << EOF > ./seed/openstack/content/network
iface eth0 inet static
address 192.168.1.90
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.254
dns-nameservers 8.8.8.8
EOF
Bye, Florian
old anwer
Hi avladu,
thanks for your help. I did as advised. Still the same error. Even worse, I can't get it to work even completely isolated:
$ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> debian_network_conf="""
... iface eth0 inet static
... address 192.168.1.90
... netmask 255.255.255.0
... broadcast 192.168.1.255
... gateway 192.168.1.254
... dns-nameserver 8.8.8.8
...
... """
>>> m = re.search(r'iface eth0 inet static\s+'
... r'address\s+(?P<address>[^\s]+)\s+'
... r'netmask\s+(?P<netmask>[^\s]+)\s+'
... r'broadcast\s+(?P<broadcast>[^\s]+)\s+'
... r'gateway\s+(?P<gateway>[^\s]+)\s+'
... r'dns\-nameservers\s+(?P<dnsnameservers>[^\r\n]+)\s+',
... debian_network_conf)
>>>
>>>
whereas, without concatenating the regexp I can get matches
>>> re.search(r'iface eth0 inet static\s+',debian_network_conf)
<_sre.SRE_Match object at 0x10ce798b8>
>>> re.search(r'address\s+(?P<address>[^\s]+)\s+',debian_network_conf)
<_sre.SRE_Match object at 0x10ce78990>
So, what am I doing wrong?
Thanks in advance, Florian