Adding validations for env/fn before listing pods (#2231)

This commit is contained in:
Pradeep Lakshmi Narasimha
2021-10-22 13:27:28 +05:30
committed by GitHub
parent 3efa3bbce9
commit 772941e02e
2 changed files with 19 additions and 0 deletions
+10
View File
@@ -41,6 +41,16 @@ func ListPods(input cli.Input) error {
func (opts *ListPodsSubCommand) do(input cli.Input) error {
// validate environment
_, err := opts.Client().V1().Environment().Get(
&metav1.ObjectMeta{
Name: input.String(flagkey.EnvName),
Namespace: input.String(flagkey.NamespaceEnvironment),
})
if err != nil {
return errors.Wrap(err, "error getting environment")
}
m := &metav1.ObjectMeta{
Name: input.String(flagkey.EnvName),
Labels: map[string]string{
+9
View File
@@ -41,6 +41,15 @@ func ListPods(input cli.Input) error {
func (opts *ListPodsSubCommand) do(input cli.Input) error {
// validate function
_, err := opts.Client().V1().Function().Get(&metav1.ObjectMeta{
Name: input.String(flagkey.FnName),
Namespace: input.String(flagkey.NamespaceFunction),
})
if err != nil {
return errors.Wrap(err, "error getting function")
}
m := &metav1.ObjectMeta{
Name: input.String(flagkey.FnName),
Labels: map[string]string{