Bug 42676 - Add a script for school bulk import
Add a script for school bulk import
Status: RESOLVED DUPLICATE of bug 46765
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 4.1 R2
Other Linux
: P5 normal (vote)
: ---
Assigned To: UCS@school maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-10-13 23:14 CEST by Michael Grandjean
Modified: 2018-11-13 12:57 CET (History)
3 users (show)

See Also:
What kind of report is it?: Feature Request
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments
import_schools (228 bytes, application/x-shellscript)
2017-03-28 15:29 CEST, Jan Christoph Ebersbach
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Grandjean univentionstaff 2016-10-13 23:14:40 CEST
For mid-sized and larger UCS@school environments, it would be great if we could provide an easy way to create all schools/OUs at once. Currently, "create_ou" allows only the creation of one school/OU at a time.

We should add a small script (Python?) that reads a CSV file and then calls create_ou with the values provided by the CSV file.
I suggest the following:


Path / name: 
> /usr/share/ucs-school-import/scripts/import_schools


Usage: 
> /usr/share/ucs-school-import/scripts/import_schools /path/to/file/schools.csv


CSV format:
I guess we should use the same format as for networks, computers, printers: No header, TABs as delimiter

> <School-ID>    <School-DisplayName>    <Edu-ServerName>    <NonEdu-ServerName>

CSV Example:

> gy123    Gymnasium Mitte    sedugy123-01    sadmgy123-01
> gs138    Grundschule Ost    sedugs138-01    
> bs456    Berufsschule TG    sedubs456-01    sadmbs456-01
> gy432                       sedugy432-01    	

School-ID and Edu-ServerName should be mandatory values.
-> If there is no school display name given, use the School-ID
-> If there is no name for the Non-Edu-Server given, do _not_ create one


Safety checks:
- Does the school/OU already exist? 
  If yes, skip this school and print an eye-catching error message
- Does one of the given server names already exist?
  If yes, skip this school and print an eye-catching error message


create_ou:
After gathering and checking all relevant information, the script should then put together something like this:

> /usr/share/ucs-school-import/scripts/create_ou --displayName="${School-DisplayName}" \
>     "${School-ID}" \
>     "${Edu-ServerName}" \
>     "${NonEdu-ServerName}"
Comment 1 Jan Christoph Ebersbach univentionstaff 2017-03-28 15:29:15 CEST
Created attachment 8667 [details]
import_schools

Here is the example for the script that Michael talked about.
Comment 2 Ole Schwiegert univentionstaff 2018-11-13 12:57:04 CET

*** This bug has been marked as a duplicate of bug 46765 ***