From 748d86411be67092bea71939802259d885f1dcde Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Sat, 2 May 2020 13:31:09 +0300 Subject: [PATCH] Remove git deamon functionality Caching git repositories has been deprecated in Queens, so it's high time we removed this functionality. This shouldn't influece OSA deployments in any way. Change-Id: I35829aa35489f06dbb3b65f522f0a08318eccbfa --- defaults/main.yml | 4 ---- handlers/main.yml | 22 ---------------------- tasks/repo_post_install.yml | 15 --------------- tasks/repo_pre_install.yml | 17 ----------------- templates/git.service.j2 | 8 -------- templates/git.socket.j2 | 9 --------- templates/lsyncd.lua.j2 | 14 +------------- templates/repo_prepost_cmd.sh.j2 | 6 ------ tests/ansible-role-requirements.yml | 4 ---- tests/test-repo-server-functional.yml | 13 ------------- vars/debian.yml | 1 - vars/redhat.yml | 2 -- vars/suse.yml | 2 -- 13 files changed, 1 insertion(+), 116 deletions(-) delete mode 100644 templates/git.service.j2 delete mode 100644 templates/git.socket.j2 diff --git a/defaults/main.yml b/defaults/main.yml index 3cd4231..e228b99 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -50,10 +50,6 @@ repo_recreate_keys: False # Main web server port repo_server_port: 8181 -# Set the git file paths -repo_git_cache_dirname: openstackgit -repo_git_cache_dir: "{{ repo_service_home_folder }}/repo/{{ repo_git_cache_dirname }}" - # This directory is used by the repo_build, and will cause problems if synced # to repo_containers with other releases. repo_build_global_links_dirname: links diff --git a/handlers/main.yml b/handlers/main.yml index dfa27b1..d19d0c8 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -46,28 +46,6 @@ retries: 5 delay: 2 -- name: reload git-daemon - service: - name: "git-daemon" - enabled: yes - state: restarted - daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}" - register: _restart - until: _restart is success - retries: 5 - delay: 2 - -- name: reload git socket - service: - name: "git.socket" - enabled: yes - state: restarted - daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}" - register: _restart - until: _restart is success - retries: 5 - delay: 2 - # TODO(odyssey4me): # Remove these tasks in T. They are only present for the # Q->R upgrade or for R->S upgrades for environments which diff --git a/tasks/repo_post_install.yml b/tasks/repo_post_install.yml index ee515dd..2cde8cb 100644 --- a/tasks/repo_post_install.yml +++ b/tasks/repo_post_install.yml @@ -63,18 +63,3 @@ state: "link" notify: - reload nginx - -- name: Place git daemon systemd init script - template: - src: "{{ item.src }}" - dest: "{{ item.dest }}" - mode: "0644" - owner: "root" - group: "root" - with_items: - - src: "git.service.j2" - dest: "{{ systemd_utils_prefix }}/system/git@.service" - - src: "git.socket.j2" - dest: "{{ systemd_utils_prefix }}/system/git.socket" - notify: - - reload git socket \ No newline at end of file diff --git a/tasks/repo_pre_install.yml b/tasks/repo_pre_install.yml index 6c179eb..c1222a6 100644 --- a/tasks/repo_pre_install.yml +++ b/tasks/repo_pre_install.yml @@ -58,23 +58,6 @@ owner: "root" group: "root" -# TODO(evrardjp): -# The functionality provided by the following two tasks is -# deprecated in Queens and should be removed in Rocky. Apply -# the changes as done in https://review.openstack.org/521750 -- name: Check if the git folder exists already - stat: - path: "{{ repo_git_cache_dir }}" - register: _git_folder - -- name: Git service data folder setup - file: - path: "{{ (_git_folder.stat.exists and _git_folder.stat.islnk) | ternary(_git_folder.stat.lnk_source, repo_git_cache_dir) }}" - state: "directory" - owner: "{{ repo_service_user_name }}" - group: "{{ repo_service_group_name }}" - recurse: true - - name: File and directory setup (root user) file: path: "{{ item.path }}" diff --git a/templates/git.service.j2 b/templates/git.service.j2 deleted file mode 100644 index dc6d7ac..0000000 --- a/templates/git.service.j2 +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Git Repositories Server Daemon -Documentation=man:git-daemon(1) - -[Service] -User=nobody -ExecStart=-{{ git_daemon_path }} --base-path={{ repo_git_cache_dir }}/ --export-all --user-path=public_git --syslog --inetd --verbose -StandardInput=socket diff --git a/templates/git.socket.j2 b/templates/git.socket.j2 deleted file mode 100644 index 3dec01d..0000000 --- a/templates/git.socket.j2 +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Git Activation Socket - -[Socket] -ListenStream=9418 -Accept=true - -[Install] -WantedBy=sockets.target diff --git a/templates/lsyncd.lua.j2 b/templates/lsyncd.lua.j2 index b3f6376..f3f05f7 100644 --- a/templates/lsyncd.lua.j2 +++ b/templates/lsyncd.lua.j2 @@ -618,7 +618,7 @@ sync { rsync, source = "{{ repo_service_home_folder }}/repo", target = "{{ hostvars[node]['ansible_host'] }}:{{ repo_service_home_folder }}/repo", - exclude = {"{{ repo_git_cache_dirname }}", "{{ repo_build_global_links_dirname }}"}, + exclude = {{ repo_build_global_links_dirname }}", rsync = { compress = true, acls = true, @@ -627,17 +627,5 @@ sync { postcmd = "sudo {{ repo_service_home_folder }}/repo/repo_prepost_cmd.sh post-www" } } -sync { - rsync, - source = "{{ repo_git_cache_dir }}", - target = "{{ hostvars[node]['ansible_host'] }}:{{ repo_git_cache_dir }}", - rsync = { - compress = true, - acls = true, - rsh = "/usr/bin/ssh -l {{ repo_service_user_name }} -i {{ repo_service_home_folder }}/.ssh/id_rsa -o StrictHostKeyChecking=no -o ServerAliveInterval=30 -o ServerAliveCountMax=5", - precmd = "sudo {{ repo_service_home_folder }}/repo/repo_prepost_cmd.sh pre-git", - postcmd = "sudo {{ repo_service_home_folder }}/repo/repo_prepost_cmd.sh post-git" - } -} {% endif %} {% endfor %} diff --git a/templates/repo_prepost_cmd.sh.j2 b/templates/repo_prepost_cmd.sh.j2 index 122d0d0..2b49ce7 100644 --- a/templates/repo_prepost_cmd.sh.j2 +++ b/templates/repo_prepost_cmd.sh.j2 @@ -11,12 +11,6 @@ post-www) ln -s /etc/nginx/sites-available/openstack-slushee.vhost /etc/nginx/sites-enabled/openstack-slushee.vhost systemctl reload nginx ;; -pre-git) - systemctl stop git.socket - ;; -post-git) - systemctl start git.socket - ;; *) echo "Unknown command." esac diff --git a/tests/ansible-role-requirements.yml b/tests/ansible-role-requirements.yml index 9963d42..f5d8693 100644 --- a/tests/ansible-role-requirements.yml +++ b/tests/ansible-role-requirements.yml @@ -2,10 +2,6 @@ src: https://opendev.org/openstack/openstack-ansible-apt_package_pinning scm: git version: master -- name: pip_install - src: https://opendev.org/openstack/openstack-ansible-pip_install - scm: git - version: master - name: openstack_hosts src: https://opendev.org/openstack/openstack-ansible-openstack_hosts scm: git diff --git a/tests/test-repo-server-functional.yml b/tests/test-repo-server-functional.yml index aa351b4..9f576ec 100644 --- a/tests/test-repo-server-functional.yml +++ b/tests/test-repo-server-functional.yml @@ -45,16 +45,3 @@ assert: that: - "repo_dir.stat.exists" - - - name: Clone repo for testing - git: - repo: "https://opendev.org/openstack/openstack-ansible-repo_server" - dest: /var/www/repo/openstackgit/repo_server - version: master - - - name: Check git daemon is functioning - git: - repo: "git://localhost/repo_server" - dest: /tmp/repo_server - version: master - accept_hostkey: yes diff --git a/vars/debian.yml b/vars/debian.yml index 5817c34..69d2966 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -17,7 +17,6 @@ systemd_utils_prefix: "/lib/systemd" repo_nginx_pid: /var/run/nginx.pid -git_daemon_path: /usr/lib/git-core/git-daemon rsyncd_service_name: rsync repo_server_distro_packages: diff --git a/vars/redhat.yml b/vars/redhat.yml index 9b4fa75..926b350 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -17,11 +17,9 @@ systemd_utils_prefix: "/lib/systemd" repo_nginx_pid: /run/nginx.pid -git_daemon_path: /usr/libexec/git-core/git-daemon rsyncd_service_name: rsyncd repo_server_distro_packages: - - git-daemon - lsyncd - nginx - openssh-server diff --git a/vars/suse.yml b/vars/suse.yml index a06b442..8243e3a 100644 --- a/vars/suse.yml +++ b/vars/suse.yml @@ -18,11 +18,9 @@ systemd_utils_prefix: "/usr/lib/systemd" repo_nginx_pid: /var/run/nginx.pid -git_daemon_path: /usr/lib/git/git-daemon rsyncd_service_name: rsyncd repo_server_distro_packages: - - git-daemon - lsyncd - nginx - openssh