-
Notifications
You must be signed in to change notification settings - Fork 156
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
extend Run() signature to include baseDir; unify agentInit options #3914
Conversation
yetus found some minor nits in the modified files. I fixed them. It also found some false positives, which I ignored. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3914 +/- ##
=======================================
Coverage 17.51% 17.51%
=======================================
Files 3 3
Lines 805 805
=======================================
Hits 141 141
Misses 629 629
Partials 35 35 ☔ View full report in Codecov by Sentry. |
can you please put this text also into the commit message? |
Sure, made a short-form version of it. Done. |
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.
The yetus complaints are about unmodified code, so ignoring those.
Re-running eden tests.
A go test failure: |
af04e13
to
a8bfd5b
Compare
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.
There is also a Version global variable and a line in the Makefile to set main.Version which makes sense removing as part of removing versionPtr.
I removed it from the Makefile. |
d251b7c
to
d26bd25
Compare
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
Well, some eden tests pass, which is a distinct improvement. |
…agent.Init; remove pidfile creation from all pillar services, replacing with call to agent.Init(WithPidfile()); passed inline or not explicitly to Run() Signed-off-by: Avi Deitcher <avi@deitcher.net>
Signed-off-by: Avi Deitcher <avi@deitcher.net>
Signed-off-by: Avi Deitcher <avi@deitcher.net>
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.
Run eden again
A few changes in this PR, closely related. None should change functionality, but let's let CI be the judge of that.
1. Extend the pillar service
Run()
signature to include baseDirThere are a few activities that take place inside start of each service, notably creating a pidfile.
That has been hard-coded to
/run/<agentName>.pid
in the past. The previous PR #3911 created an option pass a different base directory than/run/
.This PR plumbs the option for the basedir through to each agent via adding an option to
Run()
, and then passes it on when creating the pidfile. In normal use case, nothing changes. This creates override options.2. Unify creation of pidfile
Each service does pidfile creation a wee bit differently:
agentbase.Init(agentbase.WithPidFile())
agentbase.Init()
without that option, and then callpidfile.CheckAndCreatePidfile()
a few lines later.This unifies all of those to call
WithPidFile()
unless they do not create a pidfile. Those that have it optional, set the argument optionally.3. Create a
WithBaseDir()
option toagentbase.Init()
With this,
agentbase.Init()
can know where to create the pidfile.4. Remove unused options from services
The
pkg/pillar/cmd/*
services all have options for-v
for version and-p
for "do not check for pid file. None of these is used, at all. I clarified this with @eriknordmark (to give credit, he pointed out to me that these are unused), so they have been removed, in 2 separate commits.