ifstate 1.13.2__py3-none-any.whl → 1.13.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ifstate/ifstate.py +5 -3
- ifstate/vrrp.py +9 -1
- {ifstate-1.13.2.dist-info → ifstate-1.13.3.dist-info}/METADATA +11 -2
- {ifstate-1.13.2.dist-info → ifstate-1.13.3.dist-info}/RECORD +13 -13
- {ifstate-1.13.2.dist-info → ifstate-1.13.3.dist-info}/WHEEL +1 -1
- libifstate/__init__.py +1 -1
- libifstate/link/base.py +4 -1
- libifstate/link/veth.py +5 -0
- libifstate/netns/__init__.py +14 -13
- schema/ifstate.conf.schema.json +3 -3
- {ifstate-1.13.2.dist-info → ifstate-1.13.3.dist-info}/LICENSE +0 -0
- {ifstate-1.13.2.dist-info → ifstate-1.13.3.dist-info}/entry_points.txt +0 -0
- {ifstate-1.13.2.dist-info → ifstate-1.13.3.dist-info}/top_level.txt +0 -0
ifstate/ifstate.py
CHANGED
@@ -4,6 +4,7 @@ from libifstate.parser import YamlParser
|
|
4
4
|
from libifstate import __version__, IfState
|
5
5
|
from libifstate.exception import FeatureMissingError, LinkNoConfigFound, LinkCircularLinked, NetNSNotRoot, ParserValidationError, ParserOpenError, ParserParseError, ParserIncludeError
|
6
6
|
from libifstate.util import logger, IfStateLogging
|
7
|
+
from ifstate.vrrp import KEEPALIVED_STATES, KEEPALIVED_IGNORE_STATES
|
7
8
|
from setproctitle import setproctitle
|
8
9
|
|
9
10
|
import argparse
|
@@ -148,7 +149,7 @@ def main():
|
|
148
149
|
action_parsers[Actions.VRRP].add_argument(
|
149
150
|
"name", type=str, help="name of the vrrp group or instance")
|
150
151
|
action_parsers[Actions.VRRP].add_argument(
|
151
|
-
"state", type=str.lower, choices=
|
152
|
+
"state", type=str.lower, choices=KEEPALIVED_STATES, help="the new state for the vrrp group or instance")
|
152
153
|
|
153
154
|
# Parameters for the vrrp-fifo action
|
154
155
|
action_parsers[Actions.VRRP_FIFO].add_argument(
|
@@ -226,8 +227,9 @@ def main():
|
|
226
227
|
ifs_config.ifs.apply()
|
227
228
|
sighup_vrrp_fifo()
|
228
229
|
elif args.action == Actions.VRRP:
|
229
|
-
|
230
|
-
|
230
|
+
if not args.state in KEEPALIVED_IGNORE_STATES:
|
231
|
+
ifs_config.ifs.apply(
|
232
|
+
args.type, args.name, args.state)
|
231
233
|
except LinkNoConfigFound:
|
232
234
|
pass
|
233
235
|
except LinkCircularLinked as ex:
|
ifstate/vrrp.py
CHANGED
@@ -12,6 +12,10 @@ import signal
|
|
12
12
|
import subprocess
|
13
13
|
import sys
|
14
14
|
|
15
|
+
KEEPALIVED_HANDLE_STATES = ['backup', 'fault', 'master', 'stop', 'unknown']
|
16
|
+
KEEPALIVED_IGNORE_STATES = ['backup_priority', 'master_priority', 'master_rx_lower_pri']
|
17
|
+
KEEPALIVED_STATES = KEEPALIVED_HANDLE_STATES + KEEPALIVED_IGNORE_STATES
|
18
|
+
|
15
19
|
class VrrpFifoProcess():
|
16
20
|
'''
|
17
21
|
Process for vrrp group/instance configuration.
|
@@ -135,7 +139,7 @@ def vrrp_fifo(args_fifo, ifs_config):
|
|
135
139
|
|
136
140
|
try:
|
137
141
|
status_pattern = re.compile(
|
138
|
-
r'(group|instance) "([^"]+)" (
|
142
|
+
r'(group|instance) "([^"]+)" (' + '|'.join(KEEPALIVED_STATES) + ')( \d+)?$', re.IGNORECASE)
|
139
143
|
|
140
144
|
with open(args_fifo) as fifo:
|
141
145
|
logger.debug("entering fifo loop...")
|
@@ -146,6 +150,10 @@ def vrrp_fifo(args_fifo, ifs_config):
|
|
146
150
|
vrrp_name = m.group(2)
|
147
151
|
vrrp_state = m.group(3)
|
148
152
|
|
153
|
+
# ignore priority changes w/o state changes
|
154
|
+
if vrrp_state.lower() in KEEPALIVED_IGNORE_STATES:
|
155
|
+
continue
|
156
|
+
|
149
157
|
vrrp_states.update(vrrp_type, vrrp_name, vrrp_state)
|
150
158
|
else:
|
151
159
|
logger.warning(f'failed to parse fifo input: {line.strip()}')
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: ifstate
|
3
|
-
Version: 1.13.
|
3
|
+
Version: 1.13.3
|
4
4
|
Summary: Manage host interface settings in a declarative manner
|
5
5
|
Home-page: https://ifstate.net/
|
6
6
|
Author: Thomas Liske
|
@@ -16,6 +16,15 @@ Provides-Extra: shell
|
|
16
16
|
Requires-Dist: pygments; extra == "shell"
|
17
17
|
Provides-Extra: wireguard
|
18
18
|
Requires-Dist: wgnlpy; extra == "wireguard"
|
19
|
+
Dynamic: author
|
20
|
+
Dynamic: author-email
|
21
|
+
Dynamic: description
|
22
|
+
Dynamic: description-content-type
|
23
|
+
Dynamic: home-page
|
24
|
+
Dynamic: license
|
25
|
+
Dynamic: provides-extra
|
26
|
+
Dynamic: requires-dist
|
27
|
+
Dynamic: summary
|
19
28
|
|
20
29
|
# IfState
|
21
30
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
ifstate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
ifstate/ifstate.py,sha256=
|
2
|
+
ifstate/ifstate.py,sha256=l6VxiAXWyoqj7T5J495gM5Nhn807f5pHmL8_kh1uJAc,8891
|
3
3
|
ifstate/shell.py,sha256=7_JFpi4icr9MijynDzbb0v5mxhFsng6PCC4m3uQ255A,2177
|
4
|
-
ifstate/vrrp.py,sha256=
|
5
|
-
libifstate/__init__.py,sha256=
|
4
|
+
ifstate/vrrp.py,sha256=cXzQZ2v-QS56ZBS8raLM4GyCjPFtTV6tg_9Drkgul1k,5952
|
5
|
+
libifstate/__init__.py,sha256=1sYuqDO01tGxGD-oJe5vwoFIC_1gVnlgN2CASdA7AzQ,30950
|
6
6
|
libifstate/exception.py,sha256=5i59BZdl56J_sNJbyU9n6uHuUNJEyDOO4FJ-neDn9Ds,2608
|
7
7
|
libifstate/log.py,sha256=XVoZdwdQoWsjuupFIuG6OP0OrBpXpx7oqyAaUhQ-nJk,4553
|
8
8
|
libifstate/util.py,sha256=vqNaa67QZ2G07bQNAisTyUKbVmp0JGkvEGgbKVTtmYA,10579
|
@@ -13,13 +13,13 @@ libifstate/bpf/map.py,sha256=cLHNMvRBDNW2yVCEf3z242_oRdU0HqVbFEYVkKXng0w,10818
|
|
13
13
|
libifstate/brport/__init__.py,sha256=NzdA8F4hr2se1bXKNnyKZbvOFlCWBq_cdjwsL1H0Y-o,2964
|
14
14
|
libifstate/fdb/__init__.py,sha256=9dpL5n8ct3CaA-z8I6ZEkD3yL6yWJQeq3fpIe9pc2zw,6486
|
15
15
|
libifstate/link/__init__.py,sha256=epVw6jY8exNeJZUmmUas91yJoeupfgIY7rthq7SGIIw,142
|
16
|
-
libifstate/link/base.py,sha256=
|
16
|
+
libifstate/link/base.py,sha256=Si31tqRTRGnHusn1hRPLrfdEmeQqRyNP4aua1DlGc_Q,34319
|
17
17
|
libifstate/link/dsa.py,sha256=Y3axTtcym6YL1voKblxctx4PoKDZHzpteKQNnEBUrS8,264
|
18
18
|
libifstate/link/physical.py,sha256=cJiq-MCfy-3XQoU-OxzgfPZZtu_pJ8u2ioJgn9VYdGk,560
|
19
19
|
libifstate/link/tun.py,sha256=m55o5cwO3h3DCLofUR-68fM4ggLoTKElp6ZJ2LrJSCc,959
|
20
|
-
libifstate/link/veth.py,sha256=
|
20
|
+
libifstate/link/veth.py,sha256=V_jmQCizI5Vv8-pcsfldSfMRTn1knR11wZDZI_yXvks,2249
|
21
21
|
libifstate/neighbour/__init__.py,sha256=FJJpbJvqnxvOEii6QDMYzW5jQDEbiEy71GQOEbqaS48,2463
|
22
|
-
libifstate/netns/__init__.py,sha256=
|
22
|
+
libifstate/netns/__init__.py,sha256=gh7WN-3ksL0jrrdZyMOIe3yV-VGrPqCqRvbJMKdHsoo,8909
|
23
23
|
libifstate/parser/__init__.py,sha256=byz1W0G7UewVc5FFie-ti3UZjGK3-75wHIaOeq0oySQ,88
|
24
24
|
libifstate/parser/base.py,sha256=VFAo05O3tiKtI381LVUMYfsDTseMKoQGTfkgnEkm3H4,4770
|
25
25
|
libifstate/parser/yaml.py,sha256=MC0kmwqt3P45z61fb_wfUqoj0iZyhFYkdPyr0UqMSZA,1415
|
@@ -28,10 +28,10 @@ libifstate/sysctl/__init__.py,sha256=L2gkoLnac_HM6RbCaKmsEuDTNj2m7U4Rjw42TEti0kg
|
|
28
28
|
libifstate/tc/__init__.py,sha256=inPdampCOIr_4oKNB3awqMkW0Eh4fpPh9jvSba6sPVg,12092
|
29
29
|
libifstate/wireguard/__init__.py,sha256=vM7vxioV9vQ3gq9SE_URf97ZfGhLsxNiam16y_gXZ5E,6225
|
30
30
|
libifstate/xdp/__init__.py,sha256=X1xhEIGng7R5d5F4KsChykT2g6H-XBRWbWABijoYDQA,7208
|
31
|
-
schema/ifstate.conf.schema.json,sha256=
|
32
|
-
ifstate-1.13.
|
33
|
-
ifstate-1.13.
|
34
|
-
ifstate-1.13.
|
35
|
-
ifstate-1.13.
|
36
|
-
ifstate-1.13.
|
37
|
-
ifstate-1.13.
|
31
|
+
schema/ifstate.conf.schema.json,sha256=NOPeI8_r1jXvgAAJeBqz92ZACNvxskId3qMykj-sG7M,201292
|
32
|
+
ifstate-1.13.3.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
33
|
+
ifstate-1.13.3.dist-info/METADATA,sha256=rsQ7HpwlR_NSsUJ6wcSANfyxp1HaR6FtNgaMkpcOU8Q,1576
|
34
|
+
ifstate-1.13.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
35
|
+
ifstate-1.13.3.dist-info/entry_points.txt,sha256=HF6jX7Uu_nF1Ly-J9uEPeiRapOxnM6LuHsb2y6Mt-k4,52
|
36
|
+
ifstate-1.13.3.dist-info/top_level.txt,sha256=A7peI7aKBaM69fsiSPvMbL3rzTKZZr5qDxKC-pHMGdE,19
|
37
|
+
ifstate-1.13.3.dist-info/RECORD,,
|
libifstate/__init__.py
CHANGED
libifstate/link/base.py
CHANGED
@@ -3,6 +3,7 @@ from libifstate.exception import ExceptionCollector, LinkTypeUnknown, NetnsUnkno
|
|
3
3
|
from libifstate.brport import BRPort
|
4
4
|
from libifstate.routing import RTLookups
|
5
5
|
from abc import ABC, abstractmethod
|
6
|
+
import errno
|
6
7
|
import os
|
7
8
|
import subprocess
|
8
9
|
import yaml
|
@@ -643,7 +644,9 @@ class Link(ABC):
|
|
643
644
|
except Exception as err:
|
644
645
|
if not isinstance(err, netlinkerror_classes):
|
645
646
|
raise
|
646
|
-
|
647
|
+
|
648
|
+
if err.code != errno.ENODEV:
|
649
|
+
excpts.add('del', err)
|
647
650
|
self.idx = None
|
648
651
|
self.create(do_apply, sysctl, excpts, "replace")
|
649
652
|
|
libifstate/link/veth.py
CHANGED
@@ -23,7 +23,12 @@ class VethLink(Link):
|
|
23
23
|
except NetnsUnknown as ex:
|
24
24
|
excpts.add(oper, ex)
|
25
25
|
return excpts
|
26
|
+
|
26
27
|
peer_link = next(iter(bind_netns.ipr.get_links(ifname=self.settings['peer'])), None)
|
28
|
+
if peer_link is None:
|
29
|
+
excpts.add(oper, LinkCannotAdd(-1,"Failed to get peer ifIndex"))
|
30
|
+
return excpts
|
31
|
+
|
27
32
|
self.ifstate.link_registry.add_link(bind_netns, peer_link)
|
28
33
|
|
29
34
|
return result
|
libifstate/netns/__init__.py
CHANGED
@@ -13,10 +13,6 @@ import subprocess
|
|
13
13
|
netns_name_map = {}
|
14
14
|
netns_name_root = None
|
15
15
|
netns_nsid_map = {}
|
16
|
-
findmnt_cmd = shutil.which('findmnt')
|
17
|
-
|
18
|
-
if findmnt_cmd is None:
|
19
|
-
logger.debug("findmnt binary is not available, netns binding of links might not be correct")
|
20
16
|
|
21
17
|
@atexit.register
|
22
18
|
def close_netns():
|
@@ -52,10 +48,7 @@ class NetNameSpace():
|
|
52
48
|
else:
|
53
49
|
self.ipr = NetNSExt(name)
|
54
50
|
netns_name_map[name] = self.ipr
|
55
|
-
|
56
|
-
self.mount = name.encode("utf-8")
|
57
|
-
else:
|
58
|
-
self.mount = subprocess.check_output([findmnt_cmd, '-f', '-J', "/run/netns/{}".format(name)])
|
51
|
+
self.mount = name.encode("utf-8")
|
59
52
|
|
60
53
|
def __deepcopy__(self, memo):
|
61
54
|
'''
|
@@ -217,14 +210,14 @@ class LinkRegistry():
|
|
217
210
|
|
218
211
|
class LinkRegistryItem():
|
219
212
|
def __init__(self, registry, netns, link):
|
220
|
-
self.registry = registry
|
221
|
-
self.netns = netns
|
222
|
-
self.link = None
|
223
213
|
self.attributes = {
|
224
214
|
'index': link['index'],
|
225
215
|
'ifname': link.get_attr('IFLA_IFNAME'),
|
226
216
|
'address': link.get_attr('IFLA_ADDRESS'),
|
227
217
|
}
|
218
|
+
self.registry = registry
|
219
|
+
self.netns = netns
|
220
|
+
self.link = None
|
228
221
|
self.state = link['state']
|
229
222
|
|
230
223
|
linkinfo = link.get_attr('IFLA_LINKINFO')
|
@@ -235,8 +228,6 @@ class LinkRegistryItem():
|
|
235
228
|
self.attributes['businfo'] = self.netns.ipr.get_businfo(self.attributes['ifname'])
|
236
229
|
self.attributes['permaddr'] = link.get_attr('IFLA_PERM_ADDRESS')
|
237
230
|
|
238
|
-
self.attributes['netns'] =self.netns.netns
|
239
|
-
|
240
231
|
def __ipr_link(self, command, **kwargs):
|
241
232
|
logger.debug("ip link set netns={} {}".format(
|
242
233
|
self.netns.netns,
|
@@ -249,6 +240,16 @@ class LinkRegistryItem():
|
|
249
240
|
def index(self):
|
250
241
|
return self.attributes['index']
|
251
242
|
|
243
|
+
@property
|
244
|
+
def netns(self):
|
245
|
+
return self._netns
|
246
|
+
|
247
|
+
@netns.setter
|
248
|
+
def netns(self, value):
|
249
|
+
self._netns = value
|
250
|
+
self.attributes['netns'] = value.netns
|
251
|
+
return self._netns
|
252
|
+
|
252
253
|
def match(self, **kwargs):
|
253
254
|
for attr, value in kwargs.items():
|
254
255
|
if self.attributes.get(attr) != value:
|
schema/ifstate.conf.schema.json
CHANGED
@@ -3363,10 +3363,10 @@
|
|
3363
3363
|
"$ref": "#/$defs/iface-link_ifalias"
|
3364
3364
|
},
|
3365
3365
|
"ip6gre_remote": {
|
3366
|
-
"$ref": "#/$defs/iface-link_tun-
|
3366
|
+
"$ref": "#/$defs/iface-link_tun-remote6"
|
3367
3367
|
},
|
3368
3368
|
"ip6gre_local": {
|
3369
|
-
"$ref": "#/$defs/iface-link_tun-
|
3369
|
+
"$ref": "#/$defs/iface-link_tun-local6"
|
3370
3370
|
},
|
3371
3371
|
"ip6gre_link": {
|
3372
3372
|
"$ref": "#/$defs/iface-link_tun-dev"
|
@@ -4256,4 +4256,4 @@
|
|
4256
4256
|
}
|
4257
4257
|
}
|
4258
4258
|
}
|
4259
|
-
}
|
4259
|
+
}
|
File without changes
|
File without changes
|
File without changes
|