Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow combination of filter and topology in exec command #1729

Merged
merged 5 commits into from
Nov 22, 2023

Conversation

steiler
Copy link
Collaborator

@steiler steiler commented Nov 16, 2023

close #1728

@steiler
Copy link
Collaborator Author

steiler commented Nov 16, 2023

We should maybe error out if neither topofile nor labels are provided?!

@steiler
Copy link
Collaborator Author

steiler commented Nov 17, 2023

mava@server01:~/projects/containerlab3$ sudo bin/containerlab exec --label clab-node-name=ext1 --cmd "ip link show dev eth1"
Error: none or more than one topology files found, can't auto select one

the issue with the ext containers is, that we are always trying to load a topo file...

@hellt
Copy link
Member

hellt commented Nov 17, 2023

I wonder if we should rather ditch topo from this command at all.
Can't we just rely on node labels to invoke commands?

@steiler
Copy link
Collaborator Author

steiler commented Nov 17, 2023

To me the remark here #1728 was quite valid, handing in a topology file and a label for a certain kind shold limit to nodes within the topo that have a certain kind ...
But it seems with all the automagic we build around this kind of combination ext container and label selection is non-trivial.

@steiler
Copy link
Collaborator Author

steiler commented Nov 17, 2023

One could argue that external containers should proabably be handled outside of clab ... and we declare this now a nono use-case

@hellt
Copy link
Member

hellt commented Nov 17, 2023

@steiler but don't we have enough labels to select both the topology name and node kind name?

What I am thinking about is

exec --label clab-topo-name=foo --label clab-kind-name=bar

to basically rely on labels to filter out the container to run exec on.

Maybe for ext-containers this is more difficult as they might not even be tagged unless we load the topology and read those fake nodes into the nodes list

@steiler steiler closed this Nov 17, 2023
@hellt hellt reopened this Nov 21, 2023
@hellt hellt marked this pull request as ready for review November 21, 2023 20:38
@hellt
Copy link
Member

hellt commented Nov 21, 2023

I unblocked this PR, and made it to work with and without a topo file, which unblocked ext-container tests.

Copy link

codecov bot commented Nov 21, 2023

Codecov Report

Merging #1729 (2401c4b) into main (f03b6fa) will increase coverage by 0.23%.
Report is 5 commits behind head on main.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1729      +/-   ##
==========================================
+ Coverage   51.62%   51.85%   +0.23%     
==========================================
  Files         143      143              
  Lines       13810    13845      +35     
==========================================
+ Hits         7129     7179      +50     
+ Misses       5891     5866      -25     
- Partials      790      800      +10     
Files Coverage Δ
cmd/exec.go 72.52% <100.00%> (+3.01%) ⬆️
cmd/root.go 74.76% <100.00%> (-1.94%) ⬇️

... and 12 files with indirect coverage changes

@steiler
Copy link
Collaborator Author

steiler commented Nov 22, 2023

/lgtm

@hellt hellt merged commit fd7e0b1 into srl-labs:main Nov 22, 2023
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

exec with --label constraint runs on all topologies
2 participants