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
snap: introduce timer service data types and validation #4633
snap: introduce timer service data types and validation #4633
Conversation
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
Introduce basic data types and validation for timer services. Timer service is defined in snap.yaml as follows: .. apps: foo: command: bin/foo daemon: oneshot # one of simple|forking|oneshot|dbus|notify timer: mon,10:00-12:00 # valid timer specification Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
4ee83ab
to
24a964f
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
@@ -549,11 +558,16 @@ type HookInfo struct { | |||
Slots map[string]*SlotInfo | |||
} | |||
|
|||
// File returns the path to the file | |||
// File returns the path to the *.socket file | |||
func (socket *SocketInfo) File() string { | |||
return filepath.Join(dirs.SnapServicesDir, socket.App.SecurityTag()+"."+socket.Name+".socket") |
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.
Nitpick for later, use fmt.Sprintf here. No need to do it now.
func (socket *SocketInfo) File() string { | ||
return filepath.Join(dirs.SnapServicesDir, socket.App.SecurityTag()+"."+socket.Name+".socket") | ||
} | ||
|
||
// File returns the path to the *.timer file | ||
func (timer *TimerInfo) File() string { | ||
return filepath.Join(dirs.SnapServicesDir, timer.App.SecurityTag()+".timer") |
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.
Same here
Codecov Report
@@ Coverage Diff @@
## master #4633 +/- ##
=========================================
+ Coverage 78.29% 78.3% +0.01%
=========================================
Files 464 464
Lines 32939 32955 +16
=========================================
+ Hits 25789 25807 +18
+ Misses 5019 5018 -1
+ Partials 2131 2130 -1
Continue to review full report at Codecov.
|
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 nice, thank you!
apps: | ||
foo: | ||
daemon: oneshot | ||
timer: mon,10:00-12:00,mon2-wed3 |
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.
Curious what will happen with timer:
is empty. I assume a parser failure?
Introduce basic data types and validation for timer services.
Timer service is defined in snap.yaml as follows: