ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
814 stars 1.49k forks source link

community.general.bitbucket_pipeline_known_host fails in case of more than 10 Known hosts are added to the bitbucket repo #8655

Open fzsys opened 1 month ago

fzsys commented 1 month ago

Summary

community.general.bitbucket_pipeline_known_host request fails at the moment of retrieving list of known hosts in case of more than 10 Known hosts are added to the bitbucket.

Issue Type

Bug Report

Component Name

bitbucket_pipeline_known_host

Ansible Version

$ ansible --version
ansible [core 2.16.8]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/igor/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/igor/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.12 (main, Mar 22 2024, 16:50:05) [GCC 11.4.0] (/usr/bin/python3)
  jinja version = 3.0.3
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
# /usr/lib/python3/dist-packages/ansible_collections
Collection        Version
----------------- -------
community.general 8.6.2

Configuration

$ ansible-config dump --only-changed
CONFIG_FILE() = /etc/ansible/ansible.cfg
EDITOR(env: EDITOR) = nano

OS / Environment

No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.4 LTS Release: 22.04 Codename: jammy

Steps to Reproduce

Use the following task with more than 10 hosts 2 times:

- name: "Make sure host keys are added to the cbe bitbucket repo"
  community.general.bitbucket_pipeline_known_host:
    client_id: "{{ bitbucket_oauth_client_id }}"
    client_secret: "{{ bitbucket_oauth_client_secret }}"
    repository: "{{ bitbucket_repo }}"
    workspace: "{{ bitbucket_namespace }}"
    name: '{{ inventory_hostname }}'
    state: present

Alternative: Use the task above with 3 hosts on the bitbucket repo that already has 8 or more known host keys 2 times.

Expected Results

I expected to see changed for each host in the first run and ok for each host on second run

Actual Results

i see error for the hosts that are added out of first 10 known hosts in the bitbucket probably because of pager

    "msg": "Failed to retrieve list of known hosts: {'url': 'http://bitbucket-pipelines.prod.public.atl-paas.net/rest/1.0/accounts/<account>/repositories/<repo>/ssh/known_hosts?page=2&pagelen=10', 'status': 403, 'server': 'CloudFront', 'date': 'Thu, 18 Jul 2024 11:20:48 GMT', 'content-type': 'text/html', 'content-length': '915', 'connection': 'close', 'x-cache': 'Error from cloudfront', 'via': '1.1 6a3ecfb1a4acff795e79a73839fdf21a.cloudfront.net (CloudFront)', 'x-amz-cf-pop': 'HEL51-P1', 'x-amz-cf-id': 'fObRstWUDitPmYWlc1mog3Yq-wEBT8KHYLTa2BThO8DJiHy6QF5tzg==', 'msg': 'HTTP Error 403: Forbidden', 'body': b'<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\\n<HTML><HEAD><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\\n<TITLE>ERROR: The request could not be satisfied</TITLE>\\n</HEAD><BODY>\\n<H1>403 ERROR</H1>\\n<H2>The request could not be satisfied.</H2>\\n<HR noshade size=\"1px\">\\nBad request.\\nWe can\\'t connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.\\n<BR clear=\"all\">\\nIf you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.\\n<BR clear=\"all\">\\n<HR noshade size=\"1px\">\\n<PRE>\\nGenerated by cloudfront (CloudFront)\\nRequest ID: fObRstWUDitPmYWlc1mog3Yq-wEBT8KHYLTa2BThO8DJiHy6QF5tzg==\\n</PRE>\\n<ADDRESS>\\n</ADDRESS>\\n</BODY></HTML>'}"
}

Code of Conduct

ansibullbot commented 1 month ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 1 month ago

cc @catcombo click here for bot help