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

[ENHANCEMENT] Allow users to console into a container by using the $JID # in addition to the hostname. #701

Open
X86BSD opened this issue May 30, 2024 · 18 comments
Labels
enhancement New feature or request

Comments

@X86BSD
Copy link
Contributor

X86BSD commented May 30, 2024

Is your feature request related to a problem? Please describe.
This was briefly discussed in #193 along with a patch (at the time) by johanhen.
This is another usability issue, not a bug. When using bastille for more than a small number of containers, using the hostname to console into the containers becomes... tedious. No one wants to type: "bastille console reallyreallylonghostnamethattakestoolongtotypeandiserrorprone". When it would be MUCH quicker and simpler and remove that pain point to simply use the JID #. "bastille console 1" is clearly easier to do than having to type in the reallyreallylonghostname.

Describe the solution you'd like
What I would like to see is a small modification so that users can simply type in the JID # when console'ing into a container. I'm not proposing changing the current way of typing in the hostname, I am simply suggesting to allow the user to enter either the hostname OR the JID # to console into a container. Ex. "bastille console 1". I am actually kind of surprised this has not been brought up before. Using hostname's only imo becomes tedious pretty quickly with more than a handful of jails. This is not a high priority of course, just something I think is a pain point I would like to see removed.

@X86BSD X86BSD added the enhancement New feature or request label May 30, 2024
@yaazkal
Copy link
Collaborator

yaazkal commented Jul 18, 2024

Thanks for the suggestion, let me say that a name like reallyreallylonghostnamethattakestoolongtotypeandiserrorprone is the user's fault in the first place as Bastille never force the naming in any way :)

That said, bastille console 1 will not work as anyone could name its jails as numbers, but maybe an option like bastille console -j 1 will be clearer. I don't think it should necesary has to delete the use of the command with the jail name, that must be preserved.

Let's see what other people think.

@yaazkal
Copy link
Collaborator

yaazkal commented Nov 24, 2024

No comments in a long time. I don't see any priority for this, what do you think @bmac2 @cedwards ?

@X86BSD
Copy link
Contributor Author

X86BSD commented Nov 24, 2024 via email

@yaazkal
Copy link
Collaborator

yaazkal commented Nov 24, 2024

Sure, thanks for commenting back.

This issue will remain open to not lost track of it, just not a priority at the moment. We will need to agree if the proposed -j option is the way to go.

Anyway PRs are welcome.

Regards.

@X86BSD
Copy link
Contributor Author

X86BSD commented Nov 24, 2024 via email

@tschettervictor
Copy link
Collaborator

I think it would be practical to have an “autocomplete” for jail names. Iocage has this. You could do “bastille console really” and I enter a jail that starts with that word, as long as that is the only one.

@tschettervictor
Copy link
Collaborator

tschettervictor commented Nov 25, 2024

Added PR #758

@yaazkal
Copy link
Collaborator

yaazkal commented Nov 26, 2024

Thanks @tschettervictor

While it does not cover what @X86BSD is asking, I guess that would be a nice feature. It will need testing. I'll left my comments in the PR next weekend.

I'll keep this issue open to not lose track of it.

@bmac2
Copy link
Collaborator

bmac2 commented Jan 5, 2025

I like the -j option. autocomplete is cool but jail number is the suggestion and I think we should do it.

@JRGTH
Copy link
Collaborator

JRGTH commented Jan 5, 2025

I'm with @yaazkal here, "I don't think it should necesary has to delete the use of the command with the jail name"

Rather than deleting an option, it just can be enhanced to also look for JID in the same command without making things complicated, and this is a very simple task to implement regardless.

Regards!

@tschettervictor
Copy link
Collaborator

Cool. I think we should expand it to allow for use with other commands also.

The "set_target" function I've recently implemented would allow for this.

I'll implement it...

@tschettervictor
Copy link
Collaborator

My opinion is that you don't need a switch, but if you specify a number as the TARGET, then the function will associate the number with the proper jail name and set it as such.

@tschettervictor
Copy link
Collaborator

I have this implemented now. Just waiting on some PRs to be accepted before I open this one.

root@bastille:~ # bastille console 20
[jail1]:
root@jail1:~ #

@X86BSD
Copy link
Contributor Author

X86BSD commented Jan 5, 2025 via email

@tschettervictor
Copy link
Collaborator

root@bastille:~ # bastille cmd "33 35 36" echo hi
[in]:
hi
[jail2]:
hi
[lv]:
hi

@tschettervictor
Copy link
Collaborator

root@bastille:~ # bastille stop 33
[in]:
in: removed
root@bastille:~ # bastille start 33
Error: JID "33" not found. Is jail running?
root@bastille:~ # bastille cmd "33 35 36" echo hi
Error: JID "33" not found. Is jail running?
[jail2]:
hi
[lv]:
hi

@tschettervictor
Copy link
Collaborator

root@bastille:~ # bastille cmd "test jail" echo hi
test1
Multiple jails found for jail:
jail1
jail2
[test1]:
Jail is not running.
Use [-f|--force] to force start the jail.

autocomplete also working

@tschettervictor
Copy link
Collaborator

Can you test #792 ?

@X86BSD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants