Skip to content

Commit

Permalink
add 'log:' to log a message in all actions
Browse files Browse the repository at this point in the history
going to use this to test defaults being applied in check/get/put

Signed-off-by: Alex Suraci <suraci.alex@gmail.com>
  • Loading branch information
vito committed Oct 18, 2020
1 parent da677dc commit 721befc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/check/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ func main() {
return
}

if req.Source.Log != "" {
logrus.Info(req.Source.Log)
}

if req.Source.CheckDelay != "" {
delay, err := time.ParseDuration(req.Source.CheckDelay)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions cmd/in/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func main() {

dest := os.Args[1]

if req.Source.Log != "" {
logrus.Info(req.Source.Log)
}

privileged, err := resource.IsPrivileged()
if err != nil {
logrus.Fatalf("could not check privilege: %s", err)
Expand Down
4 changes: 4 additions & 0 deletions cmd/out/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ func main() {
return
}

if req.Source.Log != "" {
logrus.Info(req.Source.Log)
}

if req.Params.Version == "" {
logrus.Fatal("no version specified")
return
Expand Down
3 changes: 3 additions & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ type Source struct {

// hardcoded metadata values to return on every get and put
Metadata []MetadataField `json:"metadata"`

// print a message on every action
Log string `json:"log"`
}

func (s Source) InitialVersion() string {
Expand Down

0 comments on commit 721befc

Please sign in to comment.