Skip to content

Commit

Permalink
Issue #2: Return sorted list of interfaces in case of interfaces prop…
Browse files Browse the repository at this point in the history
…erty call
  • Loading branch information
sanketsudake committed Feb 9, 2017
1 parent 40cd9b5 commit d0ced1f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ifparser/ifconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def process_ignore(self, group, groupdict, matched_str):

@property
def interfaces(self):
return self._interfaces.keys()
return sorted(self._interfaces.keys())

def get_interface(self, interface):
return self._interfaces[interface]
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ifcfg_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def setUp(self):
def test_interfaces(self):
_ifparser = self.ifparser
self.assertEqual(len(_ifparser.interfaces), 3)
self.assertEqual(_ifparser.interfaces, ['lo', 'docker0', 'eth0'])
self.assertEqual(_ifparser.interfaces, ['docker0', 'eth0', 'lo'])

def test_get(self):
_ifparser = self.ifparser
Expand All @@ -94,4 +94,4 @@ def setUp(self):
def test_interfaces(self):
_ifparser = self.ifparser
self.assertEqual(len(_ifparser.interfaces), 3)
self.assertEqual(_ifparser.interfaces, ['lo', 'wlan0', 'eth0'])
self.assertEqual(_ifparser.interfaces, ['eth0', 'lo', 'wlan0'])

0 comments on commit d0ced1f

Please sign in to comment.