Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

validateArgs bug in "gardenctl logs tf" #470

Open
neo-liang-sap opened this issue Nov 26, 2020 · 3 comments
Open

validateArgs bug in "gardenctl logs tf" #470

neo-liang-sap opened this issue Nov 26, 2020 · 3 comments
Labels
lifecycle/rotten Nobody worked on this for 12 months (final aging stage)

Comments

@neo-liang-sap
Copy link
Contributor

Describe the bug

Say we have current target stack:

gardenctl get target                       (ccee-m3/default)
target:
- kind: garden
  name: dev
- kind: seed
  name: aws
- kind: namespace
  name: shoot--sretestneo--neo-test-ar

we have a seed targeted

But in logic 16fc236#diff-59f23253994b1605ea49a120ea68de0c2ee3a4240c2825bb741f7b707695211fR80 , gardenctl will fall into return errors.New("No seed or shoot targeted")

this commit is included in #404 - @tedteng could you please check it when you have time? thanks!

To Reproduce

  1. target the stack as above
  2. run gardenctl logs tf

Expected behavior
As seed is already targeted, gardenctl logs tf should run success

Screenshots
image

Gardenctl Version (please complete the following information):
latest in master branch

Additional context

@tedteng
Copy link
Contributor

tedteng commented Dec 1, 2020

I think you can simply handle this issue by change code to

} else if !(IsTargeted(targetReader, "project") || IsTargeted(targetReader, "shoot") && IsTargeted(targetReader, "seed")) && args[0] == "tf" {

I don't know you will fix it in your PR #436 or I will help you to open a new PR to fix and merge it? let me know what's your next steps?

@neo-liang-sap
Copy link
Contributor Author

Hi @tedteng , thanks for your comments.
I tried your proposal but seems not working from my side, could you please check and confirm? thanks!
image
image
-Neo

@tedteng
Copy link
Contributor

tedteng commented Dec 1, 2020

ok, I see, I didn't pay attention to you are target the namespace at that time. As the information provided above, I think you can get the idea of how to handle this kind of issue next time when using IsTargeted , I believe you can add IsTargeted(targetReader, "namespace") inside the code. It should fix the issue now. also fix some typo thank.

} else if !(IsTargeted(targetReader, "project") || IsTargeted(targetReader, "shoot") || IsTargeted(targetReader, "seed") || IsTargeted(targetReader, "namespace")) && args[0] == "tf" {

image

@neo-liang-sap neo-liang-sap moved this from New issues to In progress in Gardenctl Backlog Dec 8, 2020
@gardener-robot gardener-robot added the lifecycle/stale Nobody worked on this for 6 months (will further age) label Sep 22, 2021
@gardener-robot gardener-robot added lifecycle/rotten Nobody worked on this for 12 months (final aging stage) and removed lifecycle/stale Nobody worked on this for 6 months (will further age) labels Mar 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lifecycle/rotten Nobody worked on this for 12 months (final aging stage)
Projects
Gardenctl Backlog
  
In progress
Development

No branches or pull requests

3 participants