SHA256
1
0
forked from pool/salt
salt/clean-up-change-attribute-from-interface-dict.patch
Klaus Kämpf ae1540a455 Accepting request 514025 from systemsmanagement:saltstack:testing
- Bugfix: clean up `change` attribute from interface dict (upstream)
  Issue: https://github.com/saltstack/salt/issues/41461
  PR: 1. https://github.com/saltstack/salt/pull/41487
      2. https://github.com/saltstack/salt/pull/41533
Added:
  * clean-up-change-attribute-from-interface-dict.patch

- Bugfix: orchestrate and batches returns false failed information
  https://github.com/saltstack/salt/issues/40635
- speed-up cherrypy by removing sleep call
- wrong os_family grains on SUSE - fix unittests (bsc#1038855)
- fix setting the language on SUSE systems (bsc#1038855)
- Bugfix: unable to use hostname for minion ID as '127' (upstream)
- Bugfix: remove sleep call in CheppryPy API handler (upstream)
- Fix core grains constants for timezone (bsc#1032931)
- Added:
  * bugfix-unable-to-use-127-as-hostname.patch
  * fix-grain-for-os_family-on-suse-series.patch
  * fix-os_family-case-in-unittest.patch
  * fix-setting-language-on-suse-systems.patch
  * fixed-issue-with-parsing-of-master-minion-returns-wh.patch
  * rest_cherrypy-remove-sleep-call.patch
  * use-correct-grain-constants-for-timezone.patch

- Update to 2016.11.4
  See https://docs.saltstack.com/en/develop/topics/releases/2016.11.4.html
  for full changelog
- Changed:
  * add-options-for-dockerng.patch
  * fix-regression-in-file.get_managed-add-unit-tests.patch

OBS-URL: https://build.opensuse.org/request/show/514025
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=89
2017-08-04 10:29:26 +00:00

85 lines
2.8 KiB
Diff

From 58468a451d7d87450fbc36beb99dd39b10f06d61 Mon Sep 17 00:00:00 2001
From: "Peter V. Saveliev" <peter@svinota.eu>
Date: Mon, 29 May 2017 16:30:49 +0200
Subject: [PATCH] clean up `change` attribute from interface dict
The attribute is hidden in IPDB from the high-level logics since
pyroute2 version 0.4.2.
Bug-Url: https://github.com/saltstack/salt/issues/41461
unit tests: add pyroute2 interface dict test
Bug-Url: https://github.com/saltstack/salt/pull/41487
Bug-Url: https://github.com/saltstack/salt/issues/41461
unit tests: fix absolute imports in test_pyroute2
Bug-Url: https://github.com/saltstack/salt/pull/41533
unit tests: add encoding clause into test_pyroute2
Bug-Url: https://github.com/saltstack/salt/pull/41533
unit tests: test_pyroute2 -- add skipIf
... and comments
Bug-Url: https://github.com/saltstack/salt/pull/41533
---
salt/beacons/network_settings.py | 2 +-
tests/unit/modules/test_pyroute2.py | 27 +++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 1 deletion(-)
create mode 100644 tests/unit/modules/test_pyroute2.py
diff --git a/salt/beacons/network_settings.py b/salt/beacons/network_settings.py
index 5af71a0804..78c387b2f2 100644
--- a/salt/beacons/network_settings.py
+++ b/salt/beacons/network_settings.py
@@ -25,7 +25,7 @@ __virtual_name__ = 'network_settings'
ATTRS = ['family', 'txqlen', 'ipdb_scope', 'index', 'operstate', 'group',
'carrier_changes', 'ipaddr', 'neighbours', 'ifname', 'promiscuity',
'linkmode', 'broadcast', 'address', 'num_tx_queues', 'ipdb_priority',
- 'change', 'kind', 'qdisc', 'mtu', 'num_rx_queues', 'carrier', 'flags',
+ 'kind', 'qdisc', 'mtu', 'num_rx_queues', 'carrier', 'flags',
'ifi_type', 'ports']
LAST_STATS = {}
diff --git a/tests/unit/modules/test_pyroute2.py b/tests/unit/modules/test_pyroute2.py
new file mode 100644
index 0000000000..a4ccce74e8
--- /dev/null
+++ b/tests/unit/modules/test_pyroute2.py
@@ -0,0 +1,27 @@
+# -*- coding: UTF-8 -*-
+
+from __future__ import absolute_import
+
+from tests.support.unit import TestCase
+from tests.support.unit import skipIf
+from salt.beacons.network_settings import ATTRS
+try:
+ from pyroute2 import IPDB
+ HAS_PYROUTE2 = True
+except ImportError:
+ HAS_PYROUTE2 = False
+
+
+@skipIf(not HAS_PYROUTE2, 'no pyroute2 installed, skipping')
+class Pyroute2TestCase(TestCase):
+
+ def test_interface_dict_fields(self):
+ with IPDB() as ipdb:
+ for attr in ATTRS:
+ # ipdb.interfaces is a dict-like object, that
+ # contains interface definitions. Interfaces can
+ # be referenced both with indices and names.
+ #
+ # ipdb.interfaces[1] is an interface with index 1,
+ # that is the loopback interface.
+ self.assertIn(attr, ipdb.interfaces[1])
--
2.13.0