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

Enable/disable chronyd service: Enable/disable chrony-wait #137

Merged
merged 2 commits into from
Jun 14, 2019

Conversation

schubi2
Copy link
Member

@schubi2 schubi2 commented Jun 13, 2019

No description provided.

@coveralls
Copy link

coveralls commented Jun 13, 2019

Coverage Status

Coverage increased (+0.3%) to 55.122% when pulling 3537f67 on master-bsc-1137196 into f5f4da4 on master.

@@ -594,6 +595,7 @@ def dhcp_ntp_servers
publish variable: :synchronize_time, type: "boolean"
publish variable: :sync_interval, type: "integer"
publish variable: :service_name, type: "string"
publish variable: :wait_service_name, type: "string"
Copy link
Member

Choose a reason for hiding this comment

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

do we need to publish this variable to component system? Is it used outside?

@service_name = "chronyd"
@wait_service_name = "chrony-wait"
Copy link
Member

Choose a reason for hiding this comment

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

can you please add here comment why it is needed, ideally with reference to bugzilla.

subject.Write
it "enables and restarts services" do
allow(subject).to receive(:check_service).and_call_original
expect(Yast::Service).to receive(:Enable).with(subject.service_name).and_return(true)
Copy link
Member

Choose a reason for hiding this comment

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

I think better it to use explicit string. So this way accessor won't be needed.

Report.Error(Message.CannotAdjustService(@service_name))
elsif !Service.Disable(@wait_service_name)
Report.Error(Message.CannotAdjustService(@wait_service_name))
end
Copy link
Member

Choose a reason for hiding this comment

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

this deserves splitting into own method.


# error report
Report.Error(Message.CannotAdjustService("NTP")) unless adjusted
if @run_service
Copy link
Member

Choose a reason for hiding this comment

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

this method contains two separate workflows enclosed in two if @run_service branches. Moreover first of them do not contain else part. It can be rewritten to avoid one level of nesting e.g. like

def check_service
  if !@run_service
    Service.Stop(@service_name)
    Service.Stop(@wait_service_name)
    return
  end
....
end

which seems to be more readable for me.

Copy link
Member

@jreidinger jreidinger left a comment

Choose a reason for hiding this comment

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

LGTM

@mchf
Copy link
Member

mchf commented Jun 14, 2019

Apart of check_service name which i see a bit misleading it lgtm. So, lets wait in @jreidinger comments.

@schubi2 schubi2 merged commit cd59db2 into master Jun 14, 2019
@schubi2 schubi2 deleted the master-bsc-1137196 branch June 14, 2019 08:42
@yast-bot
Copy link
Contributor

❌ Public Jenkins job #16 failed

@yast-bot
Copy link
Contributor

❌ Internal Jenkins job #1 failed

@yast-bot
Copy link
Contributor

✔️ Internal Jenkins job #2 successfully finished
✔️ Created IBS submit request #195554

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants