juechafun/05-原子化笔记本/Python-程序访问Linux.md

60 lines
1.3 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
#领域/Python
#复盘/2
## 一句话描述
[___沉淀Windows客户端和Linux通讯传输_____]
---
## 核心规范
>空想不如行动,积累胜于苛求。
>实践 > 沉淀 > 完美主义
实践不是盲目行动,而是带着“小目标、可验证“的方向试错,实践后必须沉淀(比如记录问题、总结规律),否则就是低水平重复。
实践大于沉淀,沉淀大于完美;完美是沉淀的终局方向,沉淀是实践的复盘产物;分域施策,避坑落地,始于行动,终于迭代。
---
## 核心定义
fabric 是对 paramiko 进行的封装
```python
# fabric 对 paramiko 进行了封装
from fabric.api import run, put, get, env
env.host_string = f"{self.current_linux_host.get()}:{LINUX_PORT}"
env.user = LINUX_USER
env.password = LINUX_PWD
env.host_key_checking = False  # 禁用密钥校验,解决连接报错
env.disable_known_hosts = True # 解决同一host密码不一致
run(命令)
```
## 三省沉淀法
- 达成了[__使用Python程序访问Linux执行命令、传输文件______]目标
- 遇到了[__新旧版本导致运行出错______]问题
- 下次改进[__标记特定版本______]
## 个人理解
[__封装了ssh和scp访问的接口______]
## 实践计划
#状态/待实践
1. [__编写通用脚本______]
2. [________]
3. [________]