Bug 1832177

Summary: [Azure] cloud-init provisioning failed in Azure [rhel-7.8.z]
Product: Red Hat Enterprise Linux 7 Reporter: Yuxin Sun <yuxisun>
Component: cloud-initAssignee: Eduardo Otubo <eterrell>
Status: CLOSED ERRATA QA Contact: Huijuan Zhao <huzhao>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 7.8CC: eterrell, germano, gveitmic, huzhao, jgreguske, jreznik, mrezanin, pvlasin, ribarry, toneata, virt-maint, xiachen, yacao
Target Milestone: rcKeywords: Regression, Reopened, TestBlocker, ZStream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: cloud-init-18.5-6.el7_8.5 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-06-23 12:21:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1827207    

Description Yuxin Sun 2020-05-06 09:32:31 UTC
Description:
cloud-init-18.5-6.el7_8.4.x86_64.rpm provisioning failed in Azure.

Version-Release number of selected components (if applicable):

Version:
RHEL-7.9
cloud-init-18.5-6.el7_8.4.x86_64.rpm

How reproducible:
100%

Steps to Reproduce:
1. Create a RHEL-7.9 in Azure with cloud-init-18.5-6.el7_8.4.x86_64.rpm enabled (without WALA).

Actual results:
Provisioning failed.

Expected results:
Provisioning successfully

Additional info:
- Seems the root cause is in cloudinit/url_helper.py. I used the url_helper.py in cloud-init-18.5-6.el7_8.3 to replace it in cloud-init-18.5-6.el7_8.4, and worked well.

2020-05-06 08:19:32,860 - url_helper.py[DEBUG]: [0/11] open 'http://168.63.129.16/machine/?comp=goalstate' with {'url': 'http://168.63.129.16/machine/?comp=goalstate', 'headers': {'User-Agent': 'Cloud-Init/18.5'}, 'allow_redirects': True, 'method': 'GET', 'timeout': 5.0} configuration
2020-05-06 08:19:32,898 - url_helper.py[DEBUG]: Please wait 1 seconds while we wait to try again
2020-05-06 08:19:33,899 - url_helper.py[DEBUG]: [1/11] open 'http://168.63.129.16/machine/?comp=goalstate' with {'url': 'http://168.63.129.16/machine/?comp=goalstate', 'headers': {'User-Agent': 'Cloud-Init/18.5'}, 'allow_redirects': True, 'method': 'GET', 'timeout': 5.0} configuration
2020-05-06 08:19:33,903 - url_helper.py[DEBUG]: Please wait 1 seconds while we wait to try again
2020-05-06 08:19:34,904 - url_helper.py[DEBUG]: [2/11] open 'http://168.63.129.16/machine/?comp=goalstate' with {'url': 'http://168.63.129.16/machine/?comp=goalstate', 'headers': {'User-Agent': 'Cloud-Init/18.5'}, 'allow_redirects': True, 'method': 'GET', 'timeout': 5.0} configuration
2020-05-06 08:19:34,908 - url_helper.py[DEBUG]: Please wait 1 seconds while we wait to try again
2020-05-06 08:19:35,909 - url_helper.py[DEBUG]: [3/11] open 'http://168.63.129.16/machine/?comp=goalstate' with {'url': 'http://168.63.129.16/machine/?comp=goalstate', 'headers': {'User-Agent': 'Cloud-Init/18.5'}, 'allow_redirects': True, 'method': 'GET', 'timeout': 5.0} configuration
2020-05-06 08:19:35,912 - url_helper.py[DEBUG]: Please wait 1 seconds while we wait to try again
......
2020-05-06 08:22:18,534 - url_helper.py[DEBUG]: [10/11] open 'http://168.63.129.16/machine/?comp=goalstate' with {'url': 'http://168.63.129.16/machine/?comp=goalstate', 'headers': {'User-Agent': 'Cloud-Init/18.5'}, 'allow_redirects': True, 'method': 'GET', 'timeout': 5.0} configuration
2020-05-06 08:22:18,538 - handlers.py[DEBUG]: finish: azure-ds/register_with_azure_and_fetch_data: FAIL: register_with_azure_and_fetch_data
2020-05-06 08:22:18,538 - util.py[DEBUG]: Recursively deleting /run/cloud-init/tmp/tmpqoe6cr
2020-05-06 08:22:18,538 - handlers.py[DEBUG]: finish: azure-ds/get_metadata_from_fabric: FAIL: get_metadata_from_fabric
2020-05-06 08:22:18,538 - DataSourceAzure.py[WARNING]: Error communicating with Azure fabric; You may experience.connectivity issues.
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAzure.py", line 678, in _negotiate
    fabric_data = metadata_func()
  File "/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/azure.py", line 40, in impl
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/azure.py", line 493, in get_metadata_from_fabric
    return shim.register_with_azure_and_fetch_data(pubkey_info=pubkey_info)
  File "/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/azure.py", line 40, in impl
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/azure.py", line 428, in register_with_azure_and_fetch_data
    'http://{0}/machine/?comp=goalstate'.format(self.endpoint))
  File "/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/azure.py", line 106, in get
    return url_helper.read_file_or_url(url, headers=headers)
  File "/usr/lib/python2.7/site-packages/cloudinit/url_helper.py", line 107, in read_file_or_url
    exception_cb=exception_cb)
  File "/usr/lib/python2.7/site-packages/cloudinit/url_helper.py", line 307, in readurl
    raise excps[-1]
UrlError: 400 Client Error: Bad Request

Comment 25 Huijuan Zhao 2020-05-20 09:18:34 UTC
The issue is gone in cloud-init-18.5-6.el7_8.5
Change the status to VERIFIED.

Comment 27 errata-xmlrpc 2020-06-23 12:21:31 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:2654