Awx: Setting base url fail with error 400

Created on 23 Oct 2019  路  5Comments  路  Source: ansible/awx

ISSUE TYPE
  • Bug Report
SUMMARY

Whe have an internal dns with a domain like "org.les800"
when i'm trying to set the base url of the tower host with something like "tower.org.les800", it fail with an error 400 and url not valid

ENVIRONMENT
  • AWX version: 8.0.0
  • AWX install method: MrMee rpm
  • Ansible version: 2.8.6
  • Operating System: CentOS 7.7
  • Web Browser: Chrome latest
STEPS TO REPRODUCE

try an url like http://tower.org.les800 in settings/system

EXPECTED RESULTS

url for the base host set

ACTUAL RESULTS

got url with the name of the server instead

ADDITIONAL INFORMATION
api medium bug

Most helpful comment

Or more generally we can change some logic in class URLField that adds an allow_number_in_top_level_domain flag and if set to True, will pass the modified regex into the validator. That way any setting of this class can be configured to have numbers in the TLD going forward.

I think this is probably a better idea going forward, and it probably makes sense to default allow_number_in_top_level_domain to True, given that numbers in TLDs is totally a thing.

All 5 comments

@fosterseth you mind taking a look at this? I'll bet it's similar to the LDAP bug you recently fixed.

@ryanpetrello yes it's same issue as the LDAP bug.

We can either make a new TowerURLBaseField class that subclasses URLField, and then feed in a custom regex pattern to the URLValidator to allow numbers in the top level domain. This is how it is done in the case of LDAPServerURIField.

Or more generally we can change some logic in class URLField that adds an allow_number_in_top_level_domain flag and if set to True, will pass the modified regex into the validator. That way any setting of this class can be configured to have numbers in the TLD going forward.

Or more generally we can change some logic in class URLField that adds an allow_number_in_top_level_domain flag and if set to True, will pass the modified regex into the validator. That way any setting of this class can be configured to have numbers in the TLD going forward.

I think this is probably a better idea going forward, and it probably makes sense to default allow_number_in_top_level_domain to True, given that numbers in TLDs is totally a thing.

Was this page helpful?
0 / 5 - 0 ratings