<commit_before>- name: setup the edxapp env
  template: >
    src=edxapp_env.j2 dest={{ edxapp_app_dir }}/edxapp_env
    owner={{ edxapp_user }}  group={{ common_web_user }}
    mode=0644

- name: create edxapp configuration dir
  file: >
    path="{{ EDXAPP_CFG_DIR }}" state=directory
    owner="{{ edxapp_user }}" group="{{ common_web_group }}"

# Optional auth for git
- name: create ssh script for git (not authenticated)
  template: >
    src=git_ssh_noauth.sh.j2 dest={{ edxapp_git_ssh }}
    owner={{ edxapp_user }} mode=750
  when: not EDXAPP_USE_GIT_IDENTITY

- name: create ssh script for git (authenticated)
  template: >
    src=git_ssh_auth.sh.j2 dest={{ edxapp_git_ssh }}
    owner={{ edxapp_user }} mode=750
  when: EDXAPP_USE_GIT_IDENTITY

- name: install read-only ssh key
  copy: >
    content="{{ EDXAPP_GIT_IDENTITY }}" dest={{ edxapp_git_identity }}
    force=yes owner={{ edxapp_user }} mode=0600
  when: EDXAPP_USE_GIT_IDENTITY

- name: check if git repo exists before pruning
  stat: path={{ edxapp_code_dir }}/.git
  register: git_dir

- name: git prune before checking out
  shell: cd {{ edxapp_code_dir }} && git remote prune origin
  environment:
    GIT_SSH: "{{ edxapp_git_ssh }}"
  sudo_user: "{{ edxapp_user }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"
  when: git_dir.stat.exists and git_dir.stat.isdir

# Do A Checkout
- name: checkout edx-platform repo into {{ edxapp_code_dir }}
  git: >
    dest={{ edxapp_code_dir }}
    repo={{ edx_platform_repo }}
    version={{ edx_platform_version }}
    accept_hostkey=yes
  sudo_user: "{{ edxapp_user }}"
  environment:
    GIT_SSH: "{{ edxapp_git_ssh }}"<commit_msg>fix the restart edxapp handler is not defined error<commit_after>- name: setup the edxapp env
  template: >
    src=edxapp_env.j2 dest={{ edxapp_app_dir }}/edxapp_env
    owner={{ edxapp_user }}  group={{ common_web_user }}
    mode=0644

- name: create edxapp configuration dir
  file: >
    path="{{ EDXAPP_CFG_DIR }}" state=directory
    owner="{{ edxapp_user }}" group="{{ common_web_group }}"

# Optional auth for git
- name: create ssh script for git (not authenticated)
  template: >
    src=git_ssh_noauth.sh.j2 dest={{ edxapp_git_ssh }}
    owner={{ edxapp_user }} mode=750
  when: not EDXAPP_USE_GIT_IDENTITY

- name: create ssh script for git (authenticated)
  template: >
    src=git_ssh_auth.sh.j2 dest={{ edxapp_git_ssh }}
    owner={{ edxapp_user }} mode=750
  when: EDXAPP_USE_GIT_IDENTITY

- name: install read-only ssh key
  copy: >
    content="{{ EDXAPP_GIT_IDENTITY }}" dest={{ edxapp_git_identity }}
    force=yes owner={{ edxapp_user }} mode=0600
  when: EDXAPP_USE_GIT_IDENTITY

- name: check if git repo exists before pruning
  stat: path={{ edxapp_code_dir }}/.git
  register: git_dir

- name: git prune before checking out
  shell: cd {{ edxapp_code_dir }} && git remote prune origin
  environment:
    GIT_SSH: "{{ edxapp_git_ssh }}"
  sudo_user: "{{ edxapp_user }}"
  when: git_dir.stat.exists and git_dir.stat.isdir

# Do A Checkout
- name: checkout edx-platform repo into {{ edxapp_code_dir }}
  git: >
    dest={{ edxapp_code_dir }}
    repo={{ edx_platform_repo }}
    version={{ edx_platform_version }}
    accept_hostkey=yes
  sudo_user: "{{ edxapp_user }}"
  environment:
    GIT_SSH: "{{ edxapp_git_ssh }}"
{'fraction_non_alphanumeric': 0.12363966142684402, 'fraction_numerical': 0.010278113663845224, 'mean_word_length': 4.059633027522936, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4900757', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1236, 'n_words': 295}