Bug 1585749
Summary: | Security Key Pair creation is not allowed with "underscore" character from the Launch Instance menu on Horizon. | |||
---|---|---|---|---|
Product: | Red Hat OpenStack | Reporter: | David Hill <dhill> | |
Component: | python-django-horizon | Assignee: | RHOS Maint <rhos-maint> | |
Status: | CLOSED ERRATA | QA Contact: | Beth White <beth.white> | |
Severity: | low | Docs Contact: | ||
Priority: | low | |||
Version: | 10.0 (Newton) | CC: | athomas, beth.white, dhill, jrist, mrunge, rdopiera, srevivo, ukalifon | |
Target Milestone: | beta | Keywords: | Triaged, ZStream | |
Target Release: | 14.0 (Rocky) | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | python-django-horizon-14.0.0-0.20180725221532.74d75da.el7ost | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 1621357 1665084 (view as bug list) | Environment: | ||
Last Closed: | 2019-01-11 11:50:06 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: | 1621357, 1665084 |
Description
David Hill
2018-06-04 15:32:56 UTC
The underscore is now allowed from the launch instance wizard, but not allowed from the key pairs page. This seems to be to opposite situation from what the bug describes. The code we changed here isn't used by that form ... are you able to revert that patch and confirm it doesn't change the behavior of the create_key form ? That part of the form regex is handled by this chunk of code: *** NEW_LINES = re.compile(r"\r|\n") KEYPAIR_NAME_REGEX = re.compile(r"^\w+(?:[- ]\w+)*$", re.UNICODE) KEYPAIR_ERROR_MESSAGES = { 'invalid': _('Key pair name may only contain letters, ' 'numbers, underscores, spaces, and hyphens ' 'and may not be white space.')} class CreateKeypair(forms.SelfHandlingForm): name = forms.RegexField(max_length=255, label=_("Key Pair Name"), regex=KEYPAIR_NAME_REGEX, error_messages=KEYPAIR_ERROR_MESSAGES) *** Out of curiosity, I tested this and it worked: ### import re KEYPAIR_NAME_REGEX = re.compile(r"^\w+(?:[- ]\w+)*$", re.UNICODE) string="test_test" pattern = KEYPAIR_NAME_REGEX.match(string) if pattern: print("matched") else: print("not matched") ### [dhill@knox openstack_dashboard]$ python regex_test.py matched Well that is strange I was just able to reproduce this issue too. And stranger is that I was able to reproduce this issue too up until now. Now I'm no longer able to reproduce this issue with the patch on and no changes at all. Could it be a browser cache issue and QA procedure ? What I did is something like this: 1) Applied the patch 2) Restarted httpd 3) Tried creating a Key Pair from the Access & Security tab 4) Didn't work for ANY Key Pairs (not just containing an underscore, all of them would just fail) then : 1) Reverted the patch 2) Restarted httpd 3) Tried creating a Key Pair from the Access & Security tab 4) Started working back again then : 1) Applied the patch 2) Restarted httpd 3) Tried creating a Key Pair from the Access & Security tab 4) Failed back again for all Key Pairs and well, then I tried lots of things like moving the undercore elsewhere in the regex, for instance "[_A-Za-z0-9 -]" , restarted httpd, retried and it failed back again. Finally, all of a sudden, it started working for some reasons . I'm wondering if there's a temp file in horizon or the browser that could have generated this situation ? It looks like you have to restart httpd twice when changing the files in /usr/share/openstack-dashboard/openstack_dashboard because the first time you restart it, it copies the change to /usr/share/openstack-dashboard/static and I'm not able to create any key pairs . Then, if I restart httpd, it starts working. What happens if you change the existing files in /usr/share/openstack-dashboard/static before restarting httpd ? Does it help ? Are you able to solve the problem by restarting httpd a second time ? I can confirm that each time I modify the file located in /usr/share/openstack-dashboard/openstack_dashboard, I need to restart httpd twice or Key Pair creation isn't working at all in that section. I'd suggest you try it too to confirm it solves it for you too. 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/RHEA-2019:0045 |