ginkgo-tools-batchssh 0.1.0__tar.gz → 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ginkgo_tools_batchssh-0.1.0 → ginkgo_tools_batchssh-0.1.1}/PKG-INFO +1 -1
- {ginkgo_tools_batchssh-0.1.0 → ginkgo_tools_batchssh-0.1.1}/ginkgo_tools_batchssh/module_SSHwrapper.py +10 -2
- {ginkgo_tools_batchssh-0.1.0 → ginkgo_tools_batchssh-0.1.1}/ginkgo_tools_batchssh.egg-info/PKG-INFO +1 -1
- {ginkgo_tools_batchssh-0.1.0 → ginkgo_tools_batchssh-0.1.1}/pyproject.toml +1 -2
- {ginkgo_tools_batchssh-0.1.0 → ginkgo_tools_batchssh-0.1.1}/README.md +0 -0
- {ginkgo_tools_batchssh-0.1.0 → ginkgo_tools_batchssh-0.1.1}/ginkgo_tools_batchssh/__init__.py +0 -0
- {ginkgo_tools_batchssh-0.1.0 → ginkgo_tools_batchssh-0.1.1}/ginkgo_tools_batchssh/moduel_convenient_tools.py +0 -0
- {ginkgo_tools_batchssh-0.1.0 → ginkgo_tools_batchssh-0.1.1}/ginkgo_tools_batchssh/module_logger.py +0 -0
- {ginkgo_tools_batchssh-0.1.0 → ginkgo_tools_batchssh-0.1.1}/ginkgo_tools_batchssh.egg-info/SOURCES.txt +0 -0
- {ginkgo_tools_batchssh-0.1.0 → ginkgo_tools_batchssh-0.1.1}/ginkgo_tools_batchssh.egg-info/dependency_links.txt +0 -0
- {ginkgo_tools_batchssh-0.1.0 → ginkgo_tools_batchssh-0.1.1}/ginkgo_tools_batchssh.egg-info/requires.txt +0 -0
- {ginkgo_tools_batchssh-0.1.0 → ginkgo_tools_batchssh-0.1.1}/ginkgo_tools_batchssh.egg-info/top_level.txt +0 -0
- {ginkgo_tools_batchssh-0.1.0 → ginkgo_tools_batchssh-0.1.1}/setup.cfg +0 -0
|
@@ -515,7 +515,7 @@ class SSHWrapper:
|
|
|
515
515
|
logger.warning(f"命令封装执行前流程,shell操作文件封装失败,未提供命令列表或命令字符串")
|
|
516
516
|
return response_dict
|
|
517
517
|
|
|
518
|
-
def commands_to_shell_run(self, trans_result: dict, sudo_to_user = False, timeout: int = 30) -> dict:
|
|
518
|
+
def commands_to_shell_run(self, trans_result: dict, sudo_to_user = False, timeout: int = 30 , transfer_directory:str = "") -> dict:
|
|
519
519
|
"""
|
|
520
520
|
运行已传输的shell文件
|
|
521
521
|
|
|
@@ -535,9 +535,17 @@ class SSHWrapper:
|
|
|
535
535
|
if sudo_to_user:
|
|
536
536
|
logger.debug(f"命令封装执行前流程,触发sudo切换执行操作")
|
|
537
537
|
# 执行转移和变更操作
|
|
538
|
-
|
|
538
|
+
if transfer_directory:
|
|
539
|
+
sudoers_shell_path = os.path.join(transfer_directory, file_name)
|
|
540
|
+
logger.debug(f"命令封装执行前流程,触发sudo切换执行操作,指定转移目录为:{transfer_directory}")
|
|
541
|
+
else:
|
|
542
|
+
if sudo_to_user == "root":sudoers_shell_path = f"/root/{file_name}"
|
|
543
|
+
else:sudoers_shell_path = f"/home/{sudo_to_user}/{file_name}"
|
|
544
|
+
logger.debug(f"命令封装执行前流程,触发sudo切换执行操作,未指定转移目录,使用账户关联目录:{sudoers_shell_path}")
|
|
545
|
+
|
|
539
546
|
logger.info(f"命令封装执行后流程,开始将shell文件{shell_path}转移至用户{sudo_to_user},目标路径为:{sudoers_shell_path}")
|
|
540
547
|
mv_result = self.execute_command(f'sudo su - root -c "chown {sudo_to_user} {shell_path};mv {shell_path} {sudoers_shell_path}"')
|
|
548
|
+
logger.debug(mv_result)
|
|
541
549
|
if not mv_result["result"]:
|
|
542
550
|
logger.warning(f"命令封装执行后流程,将shell文件{shell_path}转移至用户{sudo_to_user}失败,请检查反馈异常为:{mv_result['stderr']}")
|
|
543
551
|
return mv_result
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ginkgo-tools-batchssh"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.1"
|
|
4
4
|
description = "批量SSH操作和文件传输工具包"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [
|
|
@@ -34,4 +34,3 @@ dependencies = [
|
|
|
34
34
|
[tool.setuptools.packages.find]
|
|
35
35
|
where = ["."]
|
|
36
36
|
include = ["ginkgo_tools_batchssh*"]
|
|
37
|
-
exclude = ["batch_record*", "dist*", "__pycache__*", ".venv*", ".idea*"]
|
|
File without changes
|
{ginkgo_tools_batchssh-0.1.0 → ginkgo_tools_batchssh-0.1.1}/ginkgo_tools_batchssh/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{ginkgo_tools_batchssh-0.1.0 → ginkgo_tools_batchssh-0.1.1}/ginkgo_tools_batchssh/module_logger.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|