diff --git a/roles/mirrormanager/backend/files/umdl-required b/roles/mirrormanager/backend/files/umdl-required index 51dd138931..5ed7b3e1a8 100644 --- a/roles/mirrormanager/backend/files/umdl-required +++ b/roles/mirrormanager/backend/files/umdl-required @@ -1,5 +1,11 @@ #!/bin/bash +# This script checks for changes on the primary mirror and +# updates the database if changes are found. For most categories +# the script first checks if a fullfiletimelist- +# exists and runs the actual primary mirror scan if that file +# has changed. + if [ $# -ne 2 ]; then echo "Exactly two parameter needed. category and /path/to/logfile" exit 1 @@ -9,12 +15,13 @@ exec >> $2 exec 2>&1 CURDATE=`date +%s` - +SCANNER="/usr/bin/mm2_update-master-directory-list" if [ "${1}" == "fedora" ]; then CATEGORY="Linux" elif [ "${1}" == "epel" ]; then CATEGORY="EPEL" + SCANNER="/usr/local/bin/scan-primary-mirror" elif [ "${1}" == "alt" ]; then CATEGORY="Other" elif [ "${1}" == "fedora-secondary" ]; then @@ -34,7 +41,7 @@ fi # FULLFILETIMELIST -> FFTL if [ "${1}" == "codecs" ]; then - /usr/local/bin/lock-wrapper umdl-${1} "/usr/bin/mm2_update-master-directory-list --category \"Fedora ${CATEGORY}\"" + /usr/local/bin/lock-wrapper umdl-${1} "${SCANNER} --category \"Fedora ${CATEGORY}\"" exit 0 else FFTL="/srv/pub/${1}/fullfiletimelist-${1}" @@ -55,7 +62,7 @@ fi echo -n "${FFTL} has changed since last run. Running umdl for Fedora ${CATEGORY} at " date -/usr/local/bin/lock-wrapper umdl-${1} "/usr/bin/mm2_update-master-directory-list --category \"Fedora ${CATEGORY}\"" +/usr/local/bin/lock-wrapper umdl-${1} "${SCANNER} --category \"Fedora ${CATEGORY}\"" if [ "$?" -eq "0" ]; then # success! remember the date of this run diff --git a/roles/mirrormanager/backend/tasks/main.yml b/roles/mirrormanager/backend/tasks/main.yml index d7c33b704f..7db2b79e23 100644 --- a/roles/mirrormanager/backend/tasks/main.yml +++ b/roles/mirrormanager/backend/tasks/main.yml @@ -154,6 +154,13 @@ owner: mirrormanager group: mirrormanager mode: 0600 +- name: install scan-primary-mirror configuration file + template: + src: scan-primary-mirror.toml + dest: /etc/mirrormanager/scan-primary-mirror.toml + owner: mirrormanager + group: mirrormanager + mode: 0600 - name: create /srv/mirrorlist-server.git file: path=/srv/mirrorlist-server.git state=directory owner=mirrormanager group=mirrormanager mode=0755 - name: create /srv/scan-primary-mirror.git @@ -169,7 +176,7 @@ - name: checkout scan-primary-mirror git: repo: https://github.com/adrianreber/scan-primary-mirror.git - version: 0.1.0 + version: 0.1.1 dest: /srv/scan-primary-mirror.git become: yes become_user: mirrormanager @@ -197,7 +204,7 @@ remote_src: yes owner: root group: root - mode: 755 + mode: 0755 when: "mirrorlist_server_built is changed" - name: install scan-primary-mirror copy: @@ -206,5 +213,5 @@ remote_src: yes owner: root group: root - mode: 755 + mode: 0755 when: "scan_primary_mirror_built is changed" diff --git a/roles/mirrormanager/backend/templates/scan-primary-mirror.toml b/roles/mirrormanager/backend/templates/scan-primary-mirror.toml new file mode 100644 index 0000000000..1f6ef4dce9 --- /dev/null +++ b/roles/mirrormanager/backend/templates/scan-primary-mirror.toml @@ -0,0 +1,84 @@ +max_propagation_days = 2 +max_stale_days = 3 +excludes=[".*\\.snapshot", ".*/\\.~tmp~"] +skip_paths_for_version=["pub/alt"] +test_paths=["/test/", "/stage/"] +skip_repository_paths = ["Cloud", "Workstation", "Server", "drpms", "source"] +do_not_display_paths = ["_Beta"] + +[database] +url="postgresql://{{ mirrormanager_db_user }}:{{ mirrormanager_db_pass }}@{{ mirrormanager_db_host }}/{{ mirrormanager_db_name }}" + +### EPEL ### + +[[category]] +name="Fedora EPEL" +type="directory" +url="/srv/pub/epel/" + +[[repository_mapping]] +regex="pub/epel/testing/[\\d]/[^M].*" +prefix="testing-epel" + +[[repository_mapping]] +regex="pub/epel/[\\d]/[^M].*" +prefix="epel" + +[[repository_mapping]] +regex="pub/epel/[\\d]/Modular/.*" +prefix="epel-modular" + +[[repository_mapping]] +regex="pub/epel/testing/next/[\\d]/Everything/.*" +prefix="epel-testing-next" + +[[repository_mapping]] +regex="pub/epel/next/[\\d]/Everything/.*" +prefix="epel-next" + +[[repository_mapping]] +regex="pub/epel/playground/[\\d]/Everything/.*" +prefix="epel-playground" + +[[repository_mapping]] +regex="pub/epel/testing/[\\d]/Modular/.*" +prefix="testing-modular-epel" + +[[repository_aliases]] +from="testing-modular-epel-debug-" +to="testing-modular-debug-epel" + +# The following repository_aliases are only necessary for EPEL +# because it has some unusual repository names. + +[[repository_aliases]] +from="epel-playground-" +to="playground-epel" + +[[repository_aliases]] +from="epel-playground-debug-" +to="playground-debug-epel" + +[[repository_aliases]] +from="epel-playground-source-" +to="playground-source-epel" + +[[repository_aliases]] +from="testing-modular-epel-source-" +to="testing-modular-source-epel" + +[[repository_aliases]] +from="testing-epel-debug-" +to="testing-debug-epel" + +[[repository_aliases]] +from="testing-epel-source-" +to="testing-source-epel" + +[[repository_aliases]] +from="testing-epel-" +to="testing-epel" + +[[repository_aliases]] +from="testing-modular-epel-" +to="testing-modular-epel"