-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #36599 - Add hostname to hypervisor task with validation error #10654
Conversation
Issues: #36599 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment below :)
a5b0e46
to
72848a8
Compare
@jeremylenz let me know if this looks better? I am still getting the desired result: 18:06:48 rails.1 | 2023-07-20T18:06:48 [E|bac|92627384] The hostname virt-who-$&-1 can contain only lowercase letters, numbers, dashes and dots
18:06:48 rails.1 | 92627384 | according to RFC921, RFC952 and RFC1123 (Katello::Errors::InvalidVirtWhoHost)
18:06:48 rails.1 | 92627384 | /home/vagrant/katello/app/models/katello/concerns/host_managed_extensions.rb:210:in `ensure_no_special_chars' Based on the output though, I am more inclined to leave that as one who sentence since it has a lot of white space and putting a rubocop disable line length. |
72848a8
to
f808644
Compare
A step in the right direction! But should use This way you won't have to create a new error class (which isn't standard for validations), and it also may help you get around the long line length, since you can put a newline after each argument if you need to. |
f808644
to
1efa909
Compare
1efa909
to
2b04521
Compare
@jeremylenz updated to using the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validation code looks better now, thanks!
One more comment/question and then I'll leave it to another reviewer to do a functional test.
2b04521
to
48e67c1
Compare
@jeremylenz updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like some tests need updating ;) But LGTM from a code perspective. 👍
@jeremylenz the tests are failing with the updated code, since this is not important (set to a target milestone) and I am not good with regex, just going to close this and put it on overflow for someone else to pickup. The hostnames in the test are correct. |
@jeremylenz how does this look? I still have a few places I need to update tests, but does it look fine for APJ? @sjha4 signed up to test it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, APJ & Samir's test. 👍
1505a62
to
1bede43
Compare
f2cb475
to
fca36bc
Compare
fca36bc
to
e112095
Compare
e112095
to
d50c733
Compare
d50c733
to
f9782f9
Compare
Got error message with hostname displayed. 10:06:40 rails.1 | 2023-08-04T10:06:40 [E|bac|b157dd57] Validation failed: Name hostname can contain only lowercase letters, numbers, dashes and dots according to RFC921, RFC952 and RFC1123, Name hostname can contain only lowercase letters, numbers, dashes and dots according to RFC921, RFC952 and RFC1123, Name virt-who-$&-1 can contain only lowercase letters, numbers, dashes and dots. (ActiveRecord::RecordInvalid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍🏻
What are the changes introduced in this pull request?
Actions::Katello::Host::Hypervisors
returned the name of the hypervisor hostname reporting in instead of justhostname
Considerations taken when implementing this change?
create_host_for_hypervisor
method in abegin/rescue
statement so that if the host does not have any issues we just move along like normal.What are the testing steps for this pull request?
virt-who
withdnf
virt-who
config file in/etc/virt-who.d/
I called minefake.conf
Here is what mine looks like:[fakevirt] type=fake file=/tmp/fake.json is_hypervisor=True owner=Default_Organization hypervisor_id=$&
/tmp
create afake.json
that looks like thisvirt-who
systemctl start virt-who
InvalidVirtWhoHost
with the hostnamevirt-who-xxx
like soESC[32m2023-07-12T20:51:33ESC[0m [ESC[31mEESC[0m|ESC[36mbacESC[0m|7f084d2d] The hostname virt-who-$&-1 can contain only lowercase letters, numbers, dashes and dots according to RFC921, RFC952 and RFC1123 (Katello::Errors::InvalidVirtWhoHost)