|
251 | 251 | when: archivematica_src_configure_fprule is defined |
252 | 252 |
|
253 | 253 | - name: "Configure locations" |
| 254 | + environment: "{{ archivematica_src_ss_environment }}" |
254 | 255 | block: |
255 | 256 | # Get id of the first registered pipeline (id=1) |
256 | 257 | - name: "Configure AM: get default pipeline UUID from SS database" |
257 | | - become: "yes" |
258 | | - command: mysql {{ archivematica_src_ss_db_name }} -Ns -e "select uuid from locations_pipeline where id='1';" |
| 258 | + shell: > |
| 259 | + echo "select uuid from locations_pipeline where id='1';" |
| 260 | + | {{ archivematica_src_ss_virtualenv }}/bin/python manage.py dbshell | tail -n1 |
| 261 | + args: |
| 262 | + chdir: "{{ archivematica_src_ss_app }}" |
| 263 | + executable: "/bin/bash" |
259 | 264 | register: pipeline_uuid |
260 | 265 |
|
261 | 266 | # Gets the uuid of the first registered space (id=1) |
262 | 267 | - name: "Configure AM: get default Space UUID from SS database" |
263 | | - become: "yes" |
264 | | - command: mysql {{ archivematica_src_ss_db_name }} -Ns -e "select uuid from locations_space where id='1';" |
| 268 | + shell: > |
| 269 | + echo "select uuid from locations_space where id='1';" |
| 270 | + | {{ archivematica_src_ss_virtualenv }}/bin/python manage.py dbshell | tail -n1 |
| 271 | + args: |
| 272 | + chdir: "{{ archivematica_src_ss_app }}" |
| 273 | + executable: "/bin/bash" |
265 | 274 | register: space_uuid |
266 | 275 |
|
267 | 276 | - name: "Configure AM: get all TS descriptions from SS database" |
268 | | - become: "yes" |
269 | | - command: mysql {{ archivematica_src_ss_db_name }} -Ns -e "select description from locations_location;" |
| 277 | + shell: > |
| 278 | + echo "select description from locations_location;" |
| 279 | + | {{ archivematica_src_ss_virtualenv }}/bin/python manage.py dbshell | grep -v "^description$" |
| 280 | + args: |
| 281 | + chdir: "{{ archivematica_src_ss_app }}" |
| 282 | + executable: "/bin/bash" |
270 | 283 | register: location_descriptions |
271 | 284 |
|
272 | 285 | - name: "Configure SS: add custom locations" |
|
293 | 306 | # |
294 | 307 |
|
295 | 308 | - name: "Configure AM: get S3 Space UUID from SS database" |
296 | | - become: "yes" |
297 | | - command: mysql {{ archivematica_src_ss_db_name }} -Ns -e "select uuid from locations_space where access_protocol='S3';" |
| 309 | + shell: > |
| 310 | + echo "select uuid from locations_space where access_protocol='S3';" |
| 311 | + | {{ archivematica_src_ss_virtualenv }}/bin/python manage.py dbshell | tail -n1 |
| 312 | + args: |
| 313 | + chdir: "{{ archivematica_src_ss_app }}" |
| 314 | + executable: "/bin/bash" |
298 | 315 | register: s3_space_exists |
299 | 316 |
|
300 | 317 | - name: "Configure SS: add spaces" |
|
321 | 338 | - am_ss_s3_spaces is defined |
322 | 339 |
|
323 | 340 | - name: "Configure AM: get existing S3 Space UUID from SS database" |
324 | | - become: "yes" |
325 | | - command: mysql {{ archivematica_src_ss_db_name }} -Ns -e "select uuid from locations_space where access_protocol='S3';" |
| 341 | + shell: > |
| 342 | + echo "select uuid from locations_space where access_protocol='S3';" |
| 343 | + | {{ archivematica_src_ss_virtualenv }}/bin/python manage.py dbshell | tail -n1 |
| 344 | + args: |
| 345 | + chdir: "{{ archivematica_src_ss_app }}" |
| 346 | + executable: "/bin/bash" |
326 | 347 | register: s3_space_uuid |
327 | 348 |
|
328 | 349 | - name: "Configure SS: add S3 locations" |
|
356 | 377 | if [ x"$PURPOSE" == x"RP" ] |
357 | 378 | then |
358 | 379 | echo $LOCATION replicates $REPLICAOF |
359 | | - LOCATION_ID=$(echo "select id from locations_location where description=\"$LOCATION\";" | mysql -s -N SS) |
360 | | - REPLICAOF_ID=$(echo "select id from locations_location where description=\"$REPLICAOF\";" | mysql -s -N SS) |
361 | | - CONFIG_ID=$(echo "select id from locations_location_replicators where from_location_id=$REPLICAOF_ID and to_location_id=$LOCATION_ID;" | mysql -s -N SS) |
| 380 | + LOCATION_ID=$(echo "select id from locations_location where description=\"$LOCATION\";" | {{ archivematica_src_ss_virtualenv }}/bin/python manage.py dbshell | tail -n1 ) |
| 381 | + REPLICAOF_ID=$(echo "select id from locations_location where description=\"$REPLICAOF\";" | {{ archivematica_src_ss_virtualenv }}/bin/python manage.py dbshell | tail -n1) |
| 382 | + CONFIG_ID=$(echo "select id from locations_location_replicators where from_location_id=$REPLICAOF_ID and to_location_id=$LOCATION_ID;" | {{ archivematica_src_ss_virtualenv }}/bin/python manage.py dbshell | tail -n1) |
362 | 383 | if [ x$CONFIG_ID == x ] |
363 | 384 | then |
364 | | - echo "insert into locations_location_replicators (from_location_id, to_location_id) values($REPLICAOF_ID,$LOCATION_ID);" | mysql -s -N SS |
| 385 | + echo "insert into locations_location_replicators (from_location_id, to_location_id) values($REPLICAOF_ID,$LOCATION_ID);" | {{ archivematica_src_ss_virtualenv }}/bin/python manage.py dbshell |
365 | 386 | fi |
366 | 387 | fi |
| 388 | + args: |
| 389 | + chdir: "{{ archivematica_src_ss_app }}" |
| 390 | + executable: "/bin/bash" |
367 | 391 | environment: |
368 | 392 | PURPOSE: "{{ item.location_purpose }}" |
369 | 393 | LOCATION: "{{ item.location_description }}" |
|
0 commit comments