feat: advanced jumphost capabilities and core bug fixes
- **Core/Jumphost**: Implement native jumphost support for `ssm`, `kubectl`, and `docker` protocols via transparent ProxyCommands. - **Core/Tags**: Introduce `ssh_options` tag to pass custom arguments (e.g., `-i key.pem`) inside nested SSM SSH tunnels. - **Core/Tags**: Introduce `nc_command` tag to override default `nc` behavior in Docker/Kube tunnels (crucial for IOS-XRd VRF netns isolation). - **Core/Async**: Fix a critical bug where interactive terminal sessions disconnected immediately due to premature `asyncio.FIRST_COMPLETED` task resolution when logs or idletime were disabled. - **Services/Node**: Fix logic error in `validate_parent_folder` that prevented the creation of new nested subfolders (CLI was incorrectly checking for the subfolder's own existence instead of the parent's). - **CLI/Help**: Update documentation to include the new `region`, `profile`, `ssh_options`, and `nc_command` well-known tags.
This commit is contained in:
@@ -89,13 +89,20 @@ class NodeService(BaseService):
|
||||
"""Generate and update the internal nodes cache."""
|
||||
self.config._generate_nodes_cache(nodes=nodes, folders=folders, profiles=profiles)
|
||||
|
||||
def validate_parent_folder(self, unique_id):
|
||||
def validate_parent_folder(self, unique_id, is_folder=False):
|
||||
"""Check if parent folder exists for a given node unique ID."""
|
||||
node_folder = unique_id.partition("@")[2]
|
||||
if node_folder:
|
||||
parent_folder = f"@{node_folder}"
|
||||
if parent_folder not in self.config._getallfolders():
|
||||
raise NodeNotFoundError(f"Folder '{parent_folder}' not found.")
|
||||
if is_folder:
|
||||
uniques = self.config._explode_unique(unique_id)
|
||||
if uniques and "subfolder" in uniques and "folder" in uniques:
|
||||
parent_folder = f"@{uniques['folder']}"
|
||||
if parent_folder not in self.config._getallfolders():
|
||||
raise NodeNotFoundError(f"Folder '{parent_folder}' not found.")
|
||||
else:
|
||||
node_folder = unique_id.partition("@")[2]
|
||||
if node_folder:
|
||||
parent_folder = f"@{node_folder}"
|
||||
if parent_folder not in self.config._getallfolders():
|
||||
raise NodeNotFoundError(f"Folder '{parent_folder}' not found.")
|
||||
|
||||
|
||||
def add_node(self, unique_id, data, is_folder=False):
|
||||
@@ -115,7 +122,7 @@ class NodeService(BaseService):
|
||||
|
||||
# Check if parent folder exists when creating a subfolder
|
||||
if "subfolder" in uniques:
|
||||
self.validate_parent_folder(unique_id)
|
||||
self.validate_parent_folder(unique_id, is_folder=True)
|
||||
|
||||
self.config._folder_add(**uniques)
|
||||
self.config._saveconfig(self.config.file)
|
||||
|
||||
Reference in New Issue
Block a user