Skip to content

Commit

Permalink
Remove interval flag (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
arbulu89 authored Apr 27, 2022
1 parent c7a27b7 commit f92a353
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 11 deletions.
3 changes: 0 additions & 3 deletions cmd/config.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package cmd

import (
"time"

"github.com/spf13/viper"
"github.com/trento-project/runner/runner"
)
Expand All @@ -12,7 +10,6 @@ func LoadConfig() *runner.Config {
Host: viper.GetString("host"),
Port: viper.GetInt("port"),
CallbacksUrl: viper.GetString("callbacks-url"),
Interval: time.Duration(viper.GetInt("interval")) * time.Minute,
AnsibleFolder: viper.GetString("ansible-folder"),
}
}
4 changes: 0 additions & 4 deletions cmd/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"os"
"testing"
"time"

"github.com/spf13/cobra"
"github.com/stretchr/testify/suite"
Expand Down Expand Up @@ -49,7 +48,6 @@ func (suite *RunnerCmdTestSuite) TearDownTest() {
Host: "localhost",
Port: 5678,
CallbacksUrl: "http://192.168.1.1:8000/api/runner/callbacks",
Interval: 1 * time.Minute,
AnsibleFolder: "path/to/ansible",
}
config := LoadConfig()
Expand All @@ -63,7 +61,6 @@ func (suite *RunnerCmdTestSuite) TestConfigFromFlags() {
"--host=localhost",
"--port=5678",
"--callbacks-url=http://192.168.1.1:8000/api/runner/callbacks",
"--interval=1",
"--ansible-folder=path/to/ansible",
})
}
Expand All @@ -72,7 +69,6 @@ func (suite *RunnerCmdTestSuite) TestConfigFromEnv() {
os.Setenv("TRENTO_RUNNER_HOST", "localhost")
os.Setenv("TRENTO_RUNNER_PORT", "5678")
os.Setenv("TRENTO_RUNNER_CALLBACKS_URL", "http://192.168.1.1:8000/api/runner/callbacks")
os.Setenv("TRENTO_RUNNER_INTERVAL", "1")
os.Setenv("TRENTO_RUNNER_ANSIBLE_FOLDER", "path/to/ansible")
}

Expand Down
2 changes: 0 additions & 2 deletions cmd/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func addStartCmd(runnerCmd *cobra.Command) {
var host string
var port int
var callbacksUrl string
var interval int
var ansibleFolder string

startCmd := &cobra.Command{
Expand All @@ -68,7 +67,6 @@ func addStartCmd(runnerCmd *cobra.Command) {
startCmd.Flags().IntVar(&port, "port", 8080, "Trento Runner API port")
startCmd.Flags().StringVar(&callbacksUrl, "callbacks-url", "", "Trento web server runner callbacks API url")
startCmd.MarkFlagRequired("callbacks-url")
startCmd.Flags().IntVarP(&interval, "interval", "i", 5, "Interval in minutes to run the checks")
startCmd.Flags().StringVar(&ansibleFolder, "ansible-folder", "/tmp/trento", "Folder where the ansible file structure will be created")

runnerCmd.AddCommand(startCmd)
Expand Down
1 change: 0 additions & 1 deletion runner/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ type Config struct {
Host string
Port int
CallbacksUrl string
Interval time.Duration
AnsibleFolder string
}

Expand Down
1 change: 0 additions & 1 deletion test/fixtures/config/runner.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
host: localhost
port: 5678
callbacks-url: http://192.168.1.1:8000/api/runner/callbacks
interval: 1
ansible-folder: path/to/ansible

0 comments on commit f92a353

Please sign in to comment.