-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Fixed "DEFAULT ANSWER" to be properly deleted for Integer and Float types #4479
Fixed "DEFAULT ANSWER" to be properly deleted for Integer and Float types #4479
Conversation
Build succeeded.
|
data.default = scope.default_float; | ||
} else if (scope.type.type === 'integer') { | ||
} else if (scope.type.type === 'integer' && scope.default_int) { |
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.
@saito-hideki
We can't rely on the truthiness of scope.default_int
for all cases. For example, this would prevent someone from updating the default value to 0
.
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.
@saito-hideki
When these fields are cleared, their values can become an empty string or null depending on how it's been initialized.
Adding some more specificity to the validation checks might be all that's needed here:
...
} else if (scope.type.type === 'float' &&
scope.default_float !== '' &&
scope.default_float !== null) {
data.default = scope.default_float;
} else if (scope.type.type === 'integer' &&
scope.default_int !== '' &&
scope.default_int !== null) {
data.default = scope.default_int;
} else {
...
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.
@jakemcdermott Thank you for your kind review!
As you pointed out, there was a problem with this condition handling. So I have fixed 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.
Just a minor revision is needed (see review comments) and I think this will be ready to go.
thanks for taking a look at this, @saito-hideki !
Build failed.
|
recheck |
Build failed.
|
Build succeeded.
|
@jakemcdermott Thank you for your great advice! I have fixed wrong condition handling. |
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 good to me - thanks!
…ypes - Fixed issue ansible/tower#3639 Signed-off-by: Hideki Saito <saito@fgrep.org>
Build succeeded.
|
Build succeeded (gate pipeline).
|
SUMMARY
Fixed the value of "DEFAULT ANSWER" to be properly deleted for Integer and Float types.
ISSUE TYPE
COMPONENT NAME
AWX VERSION
ADDITIONAL INFORMATION
None