Skip to content

Commit

Permalink
Import group script: support old CSV format in 1.9
Browse files Browse the repository at this point in the history
Make the group import script retain support for the legacy CSV file
format in Yoda 1.9.
  • Loading branch information
stsnel committed Feb 28, 2024
1 parent 8c9960d commit 57a9e5d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- yimportgroups: bugfix for situation where legacy format CSV files with role suffixes where not processed
correctly in case of multiple users with the same role (YDA-5612)
- yimportgroups: retain support for legacy format CSV files with role suffixes in Yoda 1.9 and higher.

## 2024-02-19 v1.0.0

Expand Down
4 changes: 0 additions & 4 deletions unit-tests/test_importgroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,6 @@ def test_parse_csv_with_header_suffixes(self, mock_stderr):
args = {"offline_check": True}
parse_csv_file("files/header-with-suffixes.csv", args, "1.8")

# This header format not supported in 1.9 and higher
with self.assertRaises(SystemExit):
parse_csv_file("files/header-with-suffixes.csv", args, "1.9")

@patch('sys.stderr', new_callable=StringIO)
def test_parse_invalid_csv_file(self, mock_stderr):
# csv that has an unlabeled header
Expand Down
6 changes: 1 addition & 5 deletions yclienttools/importgroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ def parse_csv_file(input_file, args, yoda_version):
if label.startswith('{}:'.format(opt_label)):
found_match = True

if found_match and yoda_version not in ('1.7', '1.8'):
_exit_with_error(
'This script does not support headers with suffixes in '
'Yoda version 1.9 and higher. Field with suffix: "{}"'.format(label))
elif not found_match:
if not found_match:
_exit_with_error(
'CSV header contains unknown field "{}"'.format(label))

Expand Down

0 comments on commit 57a9e5d

Please sign in to comment.