Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Storageservice API key from database #278

Merged
merged 3 commits into from
Feb 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@
- set_fact: archivematica_src_configure_ss_api_key={{ 999999999999999999999 | random | to_uuid | hash('md5') }}
when: "archivematica_src_configure_ss_api_key is undefined and archivematica_src_configure_ss|bool"

- name: "Get SS API Key"
shell: >
echo "select key from tastypie_apikey where id in (select id from auth_user where username = '{{ archivematica_src_configure_ss_user }}');"
| {{ archivematica_src_ss_virtualenv }}/bin/python manage.py dbshell
args:
chdir: "{{ archivematica_src_ss_app }}"
executable: /bin/bash
environment: "{{ archivematica_src_ss_environment }}"
delegate_to: "{{ archivematica_src_configure_ss_url|urlsplit('hostname') }}"
become: yes
remote_user: "{{ archivematica_src_configure_ss_ssh_user | default('artefactual') }}"
register: archivematica_src_configure_ss_api_key_temp
when: "archivematica_src_configure_dashboard|bool and archivematica_src_configure_ss_api_key is undefined"

- set_fact: archivematica_src_configure_ss_api_key="{{ archivematica_src_configure_ss_api_key_temp.stdout }}"
when: "archivematica_src_configure_dashboard|bool and archivematica_src_configure_ss_api_key_temp.stdout is defined"

- name: "Check for default SS user"
become: "yes"
shell: echo 'select username from auth_user where (id=1 and last_login is NULL and first_name="" and last_name="" and email="[email protected]" and username="test");' | {{ archivematica_src_ss_virtualenv }}/bin/python manage.py dbshell
Expand Down