Skip to content
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

The validation start/end times generation is broken on other OSs than Linux #92

Closed
Nuttymoon opened this issue Aug 24, 2023 · 0 comments · Fixed by #94
Closed

The validation start/end times generation is broken on other OSs than Linux #92

Nuttymoon opened this issue Aug 24, 2023 · 0 comments · Fixed by #94
Labels
bug Something isn't working

Comments

@Nuttymoon
Copy link
Contributor

Currently, we use the pipe lookup plugin to dynamically generate the validation start/end times to add validators to Subnets:

subnet_validator_start_time_command_default: 'date -d "2 minutes" --rfc-3339=seconds | tr " " T' # in 2 minutes
subnet_validator_end_time_command_default: 'date -d "1 week 2 minutes" --rfc-3339=seconds | tr " " T' # in 1 week and 2 minutes
subnet_validator_start_time_command_darwin: "date -v+2M '+%Y-%m-%dT%H:%M:%SZ'" # in 2 minutes
subnet_validator_end_time_command_darwin: "date -v+1w -v+2M '+%Y-%m-%dT%H:%M:%SZ'" # in 1 week and 2 minutes
subnet_validator_start_time: '{{ lookup("pipe", lookup("vars", "subnet_validator_start_time_command_"+ansible_os_family | lower, default=subnet_validator_start_time_command_default)) }}'
subnet_validator_end_time: '{{ lookup("pipe", lookup("vars", "subnet_validator_end_time_command_"+ansible_os_family | lower, default=subnet_validator_end_time_command_default)) }}'

This won't work on MacOS because the os_family is actually evaluated on the Ansible target, thus taking the debian value. The lookup will then fail silently, and we end up with empty strings.

A better way to generate the start/end times would be to execute the date command on the Ansible targets and register a fact there.

@Nuttymoon Nuttymoon added the bug Something isn't working label Aug 24, 2023
@Nuttymoon Nuttymoon changed the title The validation start/end times generation is broken on other OSs than Linux The validation start/end times generation is broken on other OSs than Debian Aug 24, 2023
@Nuttymoon Nuttymoon changed the title The validation start/end times generation is broken on other OSs than Debian The validation start/end times generation is broken on other OSs than Linux Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant