Skip to content

Commit

Permalink
Dont use json for students list
Browse files Browse the repository at this point in the history
  • Loading branch information
sverhoeven committed Mar 14, 2024
1 parent 063ef96 commit daa27ca
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ rclone_cache_dir: /data/volume_2
alt_home_location: /data/volume_3
# Vagrant user is instructor
# The students defined below can be used to login as a student
students: '[["student1", "student1"], ["student2", "student2"]]'
students: 'student1:student1,student2:student2'
```
The token can be found in the eWaterCycle password manager.
Expand Down Expand Up @@ -122,7 +122,7 @@ For eWatercycle component following specialization was done
(==USERNAME== which will be replaced by the actual username of the user creating the workspace)
- students:
- default: []
- description: List of student user name and passwords. Format '[[\"<username1>\",\"<password1>\"]]'. Use '[]' for no students.
- description: List of student user name and passwords. Format '<username1>:<password1>,<username2>:<password2>'. Use '' for no students.
- course_repo:
- default: https://github.com/eWaterCycle/teaching.git
- description: Git repository url with the course source material.
Expand Down Expand Up @@ -169,7 +169,7 @@ For eWatercycle catalog item following specialization was done
- description: User who will be grading. User should be created on sram.
- students
- label: Students
- description: List of student user name and passwords. Format '[[\"<username1>\",\"<password1>\"]]'. Use '[]' for no students.
- description: List of student user name and passwords. Format '<username1>:<password1>,<username2>:<password2>'. Use '' for no students.
- num_nodes
- label: Number of nodes
- description: Only used when cloud provider `SURF HPC Cloud cluster` is selected.
Expand Down
4 changes: 2 additions & 2 deletions create_student_passwords.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def main():
usernames.append(line.strip())
except EOFError:
break
userpws = [(username, token_urlsafe(password_length)) for username in usernames]
print(json.dumps(userpws))
userpws = [':'.join([username, token_urlsafe(password_length)]) for username in usernames]
print(','.join(userpws))

main()
2 changes: 1 addition & 1 deletion roles/grader/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
name: "{{ item[0] }}"
password: "{{ item[1] | password_hash(hashtype='sha512') }}"
shell: /bin/bash
loop: "{{ students | from_json | default([]) }}"
loop: "{{ students | split(',') | map('split',':') | default([]) }}"

- name: List all non-grader_user non-system users
shell: set -o pipefail && ls -1 | grep -v lost+found | grep -v {{ grader_user }}
Expand Down

0 comments on commit daa27ca

Please sign in to comment.