host groups/tree #6

Closed
opened 2018-03-31 06:56:41 +00:00 by zlax · 7 comments
Owner

Author: @dyadMisha

can you implement host groups or tree, not just plain list?

Author: @dyadMisha can you implement host groups or tree, not just plain list?
Author
Owner

Author: @zlaxy

Yes, it's possible.
Describe in more detail which groups/tree you would like to see. How to do it in the curses-interface i understand (like directory in file tree view). But how to implement it on the command line?

You mean the possibility of creating alias for a group to send one command to many hosts at once by specifying only their group alias?

Author: @zlaxy Yes, it's possible. Describe in more detail which groups/tree you would like to see. How to do it in the curses-interface i understand (like directory in file tree view). But how to implement it on the command line? You mean the possibility of creating alias for a group to send one command to many hosts at once by specifying only their group alias?
Author
Owner

Author: @dyadMisha

Thanks for fast reply. I am talking only about how to represent hosts in interface, something like this:

[ work 1 ] (3 hosts) (press enter to collapse)
------ [ dev ] (2 hosts) (press enter to collapse)
--------------- [ ] 1 devhost1.work1.net (ssh root@10.10.10.1)
--------------- [ ] 2 devhost2.work1.net (ssh root@10.10.10.2)
------ [ prod ] (1 host) (press enter to collapse)
--------------- [ ] 1 prodhost1.work1.net (ssh root@10.10.11.1)
[ work 2 ] (7 hosts) (press enter to expand)
[ home ] (5 hosts) (press enter to expand)

Author: @dyadMisha Thanks for fast reply. I am talking only about how to represent hosts in interface, something like this: [ work 1 ] (3 hosts) (press enter to collapse) ------ [ dev ] (2 hosts) (press enter to collapse) --------------- [ ] 1 devhost1.work1.net (ssh root@10.10.10.1) --------------- [ ] 2 devhost2.work1.net (ssh root@10.10.10.2) ------ [ prod ] (1 host) (press enter to collapse) --------------- [ ] 1 prodhost1.work1.net (ssh root@10.10.11.1) [ work 2 ] (7 hosts) (press enter to expand) [ home ] (5 hosts) (press enter to expand)
Author
Owner

Author: @zlaxy

Hello, i implemented base groups functionality (one level groups):
e430142fdc
Multilevel tree implementation needs more time (with Tree object) or using external libraries (like anytree).
In a short time, without changing a lot of code, i made only one level groups. You can check it and test it. If you find any erroros/mistakes, i will fix it soon as possible. I will not be able to do multilevel tree until a few months...but, please, look on current implementation - could this be enough?

By changing expand_default variable (string 27) you could set default view of groups:

# expand groups by default
expand_default = False

False is collapsed by default, True expanded by default.

Author: @zlaxy Hello, i implemented base groups functionality (one level groups): https://github.com/zlaxy/sshch/commit/e430142fdce4b3007f89e0d7c3cc7ee6451bc9bc Multilevel tree implementation needs more time (with Tree object) or using external libraries (like anytree). In a short time, without changing a lot of code, i made only one level groups. You can check it and test it. If you find any erroros/mistakes, i will fix it soon as possible. I will not be able to do multilevel tree until a few months...but, please, look on current implementation - could this be enough? By changing `expand_default` variable (string 27) you could set default view of groups: ``` # expand groups by default expand_default = False ``` `False` is collapsed by default, `True` expanded by default.
Author
Owner

Author: @dyadMisha

  1. cursor is not visible in edit mode, it is hard to edit group aliases in this way
  2. group with space in name can not be removed
  3. if i create group first, then add hosts to it, then remove group - all hosts from the group are removed, i think you should keep them. But if i create hosts first and then create a group, hosts are assigned to the group and survive removing of the group.
Author: @dyadMisha 1) cursor is not visible in edit mode, it is hard to edit group aliases in this way 2) group with space in name can not be removed 3) if i create group first, then add hosts to it, then remove group - all hosts from the group are removed, i think you should keep them. But if i create hosts first and then create a group, hosts are assigned to the group and survive removing of the group.
Author
Owner

Author: @zlaxy

  1. 37a20a0c48
  2. 9c361bbe00
    Please, don't use alias or group names with spaces, use '_' symbol if you want to use multi-word name.
    Added strip names function during adding new aliases and groups.
  3. I can't reproduce removing hosts with removing group. Describe, please, in more detail and step by step how to reproduce this problem (with screenshots, if it s possible)
    When i remove group, aliases still exists.
Author: @zlaxy 1. https://github.com/zlaxy/sshch/commit/37a20a0c48605d69fd41123f508a44b621973654 2. https://github.com/zlaxy/sshch/commit/9c361bbe000d0df4e9b9e5f23ff3e7e1c94aef45 Please, don't use alias or group names with spaces, use '_' symbol if you want to use multi-word name. Added strip names function during adding new aliases and groups. 3. I can't reproduce removing hosts with removing group. Describe, please, in more detail and step by step how to reproduce this problem (with screenshots, if it s possible) When i remove group, aliases still exists.
Author
Owner

Author: @dyadMisha

  1. I can not reproduce it anymore..
  2. if i create alias test1, then create group test with aliases test1 and test2, then create alias test2 i will get the following config file:
$ cat ~/.config/sshch.conf 
[test1]
exec_string = ssh 1

[test]
group = test1 test2

[test2]
exec_string = ssh 2

then restart sshch and try to expand grup test it fails with:

┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ sshch 0.994, press 'h' for help                                                                                                          │
│┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐│
││ [ ] >> testTraceback (most recent call last):                                                                                          ││
││                                                File "/usr/local/bin/sshch", line 790, in <module>                                      ││
││                                                                                                      CursesMain()                      ││
││                                                                                                                    File "/usr/local/bin/sshch", line 755, in CursesMain                                                                                                            ││
││                                exec_string = ["[", selected_strings[i], "] ", stringsfull[i - 1]]                                      ││
││                                                                                                  IndexError: list index out of range   ││
││     
Author: @dyadMisha 3. I can not reproduce it anymore.. 4. if i create alias test1, then create group test with aliases test1 and test2, then create alias test2 i will get the following config file: ``` $ cat ~/.config/sshch.conf [test1] exec_string = ssh 1 [test] group = test1 test2 [test2] exec_string = ssh 2 ``` then restart sshch and try to expand grup test it fails with: ``` ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ sshch 0.994, press 'h' for help │ │┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐│ ││ [ ] >> testTraceback (most recent call last): ││ ││ File "/usr/local/bin/sshch", line 790, in <module> ││ ││ CursesMain() ││ ││ File "/usr/local/bin/sshch", line 755, in CursesMain ││ ││ exec_string = ["[", selected_strings[i], "] ", stringsfull[i - 1]] ││ ││ IndexError: list index out of range ││ ││ ```
Author
Owner

Author: @zlaxy

  1. fixed: 450b30b196

If you do not find any other related errors - please close this issue.

Author: @zlaxy 4. fixed: https://github.com/zlaxy/sshch/commit/450b30b1960b4632bbd6a0f2be399496ca17ed59 If you do not find any other related errors - please close this issue.
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: zlax/sshch#6
No description provided.