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

Make the behavior of chronyd_sync_clock rule more consistent #12039

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions linux_os/guide/services/ntp/chronyd_sync_clock/rule.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
documentation_complete: true

{{% if product == 'ubuntu2204' -%}}
{{% set makestep_line = 'makestep 1 1' -%}}
{{% set step_value = '1 1' -%}}
{{% else -%}}
{{% set makestep_line = 'makestep 1 -1' -%}}
{{% set step_value = '1 -1' -%}}
{{% endif -%}}

title: 'Synchronize internal information system clocks'
Expand Down Expand Up @@ -34,16 +34,19 @@ ocil: |-
authoritative time source when the time difference is greater than one
second. Check the value of "makestep" by running the following command:
<pre>$ sudo grep makestep {{{ chrony_conf_path }}}
{{{ makestep_line }}}</pre>
makestep {{{ step_value }}}</pre>

If it is not set to the above value, edit the {{{ chrony_conf_path }}} file
and add:
<pre>{{{ makestep_line }}}</pre>
<pre>makestep {{{ step_value }}}</pre>
Restart the chrony service:
<pre>$ sudo systemctl restart chrony.service</pre>

template:
name: "lineinfile"
name: key_value_pair_in_file
vars:
text: {{{ makestep_line }}}
key: "makestep"
value: {{{ step_value }}}
sep: ' '
sep_regex: ' '
path: {{{ chrony_conf_path }}}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# packages = chrony

{{% if product == 'ubuntu2204' -%}}
echo "makestep 1 1" >> {{{ chrony_conf_path }}}
echo "makestep 1 1" > {{{ chrony_conf_path }}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason for not being an append?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the latest doc, If multiple occurrences of key have conflicting values, the check will evaluate to fail.

{{% else -%}}
echo "makestep 1 -1" >> {{{ chrony_conf_path }}}
echo "makestep 1 -1" > {{{ chrony_conf_path }}}
{{% endif -%}}
Loading