Skip to content

Commit

Permalink
#245 don't overwrite user-supplied dvconfig.py
Browse files Browse the repository at this point in the history
  • Loading branch information
don sizemore committed Sep 2, 2022
1 parent 635426b commit bce6101
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tasks/sampledata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,35 @@
args:
chdir: '{{ dataverse.sampledata.dir }}'

- name: test for existence of dvconfig.py
ansible.builtin.stat:
path: '{{ dataverse.sampledata.dir }}/dvconfig.py'
register: user_supplied_dvconfig_py

- name: copy dvconfig.py.sample to dvconfig.py
copy:
src: '{{ dataverse.sampledata.dir }}/dvconfig.py.sample'
dest: '{{ dataverse.sampledata.dir }}/dvconfig.py'
remote_src: yes
when: not user_supplied_dvconfig_py.stat.exists

- name: strip backslash from siteUrl
set_fact:
siteUrl_stripped: '{{ siteUrl | regex_replace ("\\", "") }}'

- name: set siteUrl in dvconfig.py
- name: set siteUrl in sample dvconfig.py
replace:
dest: '{{ dataverse.sampledata.dir }}/dvconfig.py'
regexp: "^base_url = 'https://demo.dataverse.org'$"

This comment has been minimized.

Copy link
@pdurbin

pdurbin Sep 7, 2022

Member

We switched from demo to localhost here: IQSS/dataverse-sample-data@c67952f

replace: "base_url = '{{ siteUrl_stripped }}'"
when: not user_supplied_dvconfig_py.stat.exists

- name: set api token in dvconfig.py
- name: set api token in sample dvconfig.py
replace:
dest: '{{ dataverse.sampledata.dir }}/dvconfig.py'
regexp: "^api_token = ''$"
replace: "api_token = '{{ api_token }}'"
when: not user_supplied_dvconfig_py.stat.exists

- name: run sampledata
shell: 'python3 create_sample_data.py'
Expand Down

1 comment on commit bce6101

@donsizemore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pdurbin could you take a look at this when you're back from the Cape?

Please sign in to comment.