fortinet / ansible-fortimanager-generic

8 stars 6 forks source link

fixed the way to patch ansible in a more finer manner #5

Closed chillancezen closed 4 years ago

chillancezen commented 4 years ago

to patch Ansible: 1) No need to patch ansible 2.8.x

Feb-28 09:52:08 root@ubuntu0  ~/DEV/ansible-fortimanager-generic
#ansible-playbook --version
ansible-playbook 2.8.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/DEV/ansible-fortimanager-generic/ansible.2.8/lib/python3.6/site-packages/ansible
  executable location = /root/DEV/ansible-fortimanager-generic/ansible.2.8/bin/ansible-playbook
  python version = 3.6.9 (default, Nov  7 2019, 10:44:02) [GCC 8.3.0]
Feb-28 09:52:35 root@ubuntu0  ~/DEV/ansible-fortimanager-generic
#source patch_ansible
No need to patch ansible 2.8.0

2) for ansible 2.9.x which are already released, the script will automatically patch ansible

Feb-28 09:49:01 root@ubuntu0  ~/DEV/ansible-fortimanager-generic
#ansible-playbook --version
ansible-playbook 2.9.5
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/DEV/ansible-fortimanager-generic/ansible.2.9.5/lib/python3.6/site-packages/ansible
  executable location = /root/DEV/ansible-fortimanager-generic/ansible.2.9.5/bin/ansible-playbook
  python version = 3.6.9 (default, Nov  7 2019, 10:44:02) [GCC 8.3.0]

Feb-28 09:49:09 root@ubuntu0  ~/DEV/ansible-fortimanager-generic
#source patch_ansible
patching /root/DEV/ansible-fortimanager-generic/ansible.2.9.5/lib/python3.6/site-packages/ansible/plugins/httpapi/fortimanager.py
1 out of 1 hunk FAILED

3) for Ansible 2.9.x which will be released and others, the script prompts a message for use to decide whether to patch:

Feb-28 09:55:39 root@ubuntu0  ~/ansible
#ansible-playbook --version
ansible-playbook 2.10.0.dev0
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/DEV/ansible-fortimanager-generic/ansible.2.10/lib/python3.6/site-packages/ansible-2.10.0.dev0-py3.6.egg/ansible
  executable location = /root/DEV/ansible-fortimanager-generic/ansible.2.10/bin/ansible-playbook
  python version = 3.6.9 (default, Nov  7 2019, 10:44:02) [GCC 8.3.0]

Feb-28 09:58:08 root@ubuntu0  ~/DEV/ansible-fortimanager-generic
#source patch_ansible
do you want to patch for 2.10.0.dev0 ? [yes/no]yes
patching /root/DEV/ansible-fortimanager-generic/ansible.2.10/lib/python3.6/site-packages/ansible-2.10.0.dev0-py3.6.egg/ansible/plugins/httpapi/fortimanager.py
1 out of 1 hunk FAILED

cc @frankshen01