Skip to content

Commit

Permalink
parted: fix the ordering of list command
Browse files Browse the repository at this point in the history
The command `parted -m -s {} print` do not print the "Type" column,
but after the "File System" column print the name of the partition.

This point that the type of the partition cannot be extracted using
parted with machine parseable output.
  • Loading branch information
aplanas committed Oct 1, 2018
1 parent 3dc57a6 commit f23d618
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions salt/modules/parted.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ def list_(device, unit=None):
'start': cols[1],
'end': cols[2],
'size': cols[3],
'type': cols[4],
'file system': cols[5],
'file system': cols[4],
'name': cols[5],
'flags': cols[6]}
else:
raise CommandExecutionError(
Expand Down
32 changes: 16 additions & 16 deletions tests/unit/modules/test_parted.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,17 @@ def test_list__valid_cmd_output(self):
'end': '150MB',
'number': '1',
'start': '17.4kB',
'file system': '',
'file system': 'ext3',
'flags': 'boot',
'type': 'ext3',
'name': '',
'size': '150MB'},
'2': {
'end': '4000GB',
'number': '2',
'start': '3921GB',
'file system': '',
'file system': 'linux-swap(v1)',
'flags': '',
'type': 'linux-swap(v1)',
'name': '',
'size': '79.3GB'
}
}
Expand Down Expand Up @@ -245,17 +245,17 @@ def test_list__valid_unit_valid_cmd_output(self):
'end': '150MB',
'number': '1',
'start': '17.4kB',
'file system': '',
'file system': 'ext3',
'flags': 'boot',
'type': 'ext3',
'name': '',
'size': '150MB'},
'2': {
'end': '4000GB',
'number': '2',
'start': '3921GB',
'file system': '',
'file system': 'linux-swap(v1)',
'flags': '',
'type': 'linux-swap(v1)',
'name': '',
'size': '79.3GB'
}
}
Expand All @@ -282,17 +282,17 @@ def test_list__valid_legacy_cmd_output(self):
'end': '150MB',
'number': '1',
'start': '17.4kB',
'file system': '',
'file system': 'ext3',
'flags': 'boot',
'type': 'ext3',
'name': '',
'size': '150MB'},
'2': {
'end': '4000GB',
'number': '2',
'start': '3921GB',
'file system': '',
'file system': 'linux-swap(v1)',
'flags': '',
'type': 'linux-swap(v1)',
'name': '',
'size': '79.3GB'
}
}
Expand All @@ -319,17 +319,17 @@ def test_list__valid_unit_valid_legacy_cmd_output(self):
'end': '150MB',
'number': '1',
'start': '17.4kB',
'file system': '',
'file system': 'ext3',
'flags': 'boot',
'type': 'ext3',
'name': '',
'size': '150MB'},
'2': {
'end': '4000GB',
'number': '2',
'start': '3921GB',
'file system': '',
'file system': 'linux-swap(v1)',
'flags': '',
'type': 'linux-swap(v1)',
'name': '',
'size': '79.3GB'
}
}
Expand Down

0 comments on commit f23d618

Please sign in to comment.