Skip to content

Commit

Permalink
fix: try to create django users for IDAs only when service name is sp…
Browse files Browse the repository at this point in the history
…ecified

When creating a django user for edxapp and not for IDA (i.e. when
service name is not specified), we don't want the tasks that create
django users in IDAs to be executed, because they don't pass `lms`
and/or `cms` to `manage.py`, so these tasks fail for edxapp. To fix that
we add a predicate that checks that service name has been specified to
these tasks, so they only run when creating a django user for an IDA.
  • Loading branch information
Cup0fCoffee committed Jul 10, 2022
1 parent 4eb14b0 commit d390511
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions playbooks/manage_edxapp_users_and_groups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
{% if item.get('permissions', []) | length %}--permissions {{ item.permissions | default([]) | map('quote') | join(' ') }}{% endif %}
{% if item.get('remove') %}--remove{% endif %}
with_items: "{{ django_groups }}"
when: (not group_environment) or group_environment in item.environments
when: (service | length > 0) and (not group_environment) or group_environment in item.environments
become: true
become_user: "{{ common_web_user }}"

Expand All @@ -214,7 +214,7 @@
{% if item.get('unusable_password') %}--unusable-password{% endif %}
{% if item.get('initial_password_hash') %}--initial-password-hash {{ item.initial_password_hash | quote }}{% endif %}
with_items: "{{ django_users }}"
when: not item.get('unusable_password')
when: (service | length > 0) and not item.get('unusable_password')
register: manage_users_result
failed_when: (manage_users_result is failed) and not (ignore_user_creation_errors | bool)
retries: 3
Expand All @@ -235,7 +235,7 @@
{% if item.get('unusable_password') %}--unusable-password{% endif %}
{% if item.get('initial_password_hash') %}--initial-password-hash {{ item.initial_password_hash | quote }}{% endif %}
with_items: "{{ django_users }}"
when: item.get('unusable_password')
when: (service | length > 0) and item.get('unusable_password')
register: manage_users_result
failed_when: (manage_users_result is failed) and not (ignore_user_creation_errors | bool)
retries: 3
Expand Down

0 comments on commit d390511

Please sign in to comment.