Skip to content

Commit

Permalink
Make owner optional for runners and jobs command(s)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
  • Loading branch information
alexellis committed Aug 15, 2023
1 parent 4b0bc93 commit bf1af0b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 0 additions & 4 deletions cmd/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ func runJobsE(cmd *cobra.Command, args []string) error {
return err
}

if len(owner) == 0 {
return fmt.Errorf("owner is required")
}

if len(pat) == 0 {
return fmt.Errorf("pat is required")
}
Expand Down
4 changes: 0 additions & 4 deletions cmd/runners.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ func runRunnersE(cmd *cobra.Command, args []string) error {
return err
}

if len(owner) == 0 {
return fmt.Errorf("owner is required")
}

if len(pat) == 0 {
return fmt.Errorf("pat is required")
}
Expand Down
10 changes: 8 additions & 2 deletions pkg/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ func (c *Client) ListJobs(patStr string, owner string, staff bool, json bool) (s
q.Set("staff", "1")
}

q.Set("owners", owner)
if len(owner) > 0 {
q.Set("owners", owner)
}

u.RawQuery = q.Encode()

req, err := http.NewRequest(http.MethodGet, u.String(), nil)
Expand Down Expand Up @@ -82,7 +85,10 @@ func (c *Client) ListRunners(patStr string, owner string, staff bool, json bool)
q.Set("staff", "1")
}

q.Set("owner", owner)
if len(owner) > 0 {
q.Set("owner", owner)
}

u.RawQuery = q.Encode()

req, err := http.NewRequest(http.MethodGet, u.String(), nil)
Expand Down

0 comments on commit bf1af0b

Please sign in to comment.