chipfoundry-cli 0.1.4__tar.gz → 0.1.6__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.
- {chipfoundry_cli-0.1.4 → chipfoundry_cli-0.1.6}/PKG-INFO +1 -1
- {chipfoundry_cli-0.1.4 → chipfoundry_cli-0.1.6}/chipfoundry_cli/main.py +4 -0
- {chipfoundry_cli-0.1.4 → chipfoundry_cli-0.1.6}/chipfoundry_cli/utils.py +18 -1
- {chipfoundry_cli-0.1.4 → chipfoundry_cli-0.1.6}/pyproject.toml +1 -1
- {chipfoundry_cli-0.1.4 → chipfoundry_cli-0.1.6}/LICENSE +0 -0
- {chipfoundry_cli-0.1.4 → chipfoundry_cli-0.1.6}/README.md +0 -0
- {chipfoundry_cli-0.1.4 → chipfoundry_cli-0.1.6}/chipfoundry_cli/__init__.py +0 -0
|
@@ -48,6 +48,8 @@ def config_cmd():
|
|
|
48
48
|
key_path = console.input("Enter path to your SFTP private key (leave blank for ~/.ssh/id_rsa): ").strip()
|
|
49
49
|
if not key_path:
|
|
50
50
|
key_path = os.path.expanduser('~/.ssh/id_rsa')
|
|
51
|
+
else:
|
|
52
|
+
key_path = os.path.abspath(os.path.expanduser(key_path))
|
|
51
53
|
config = {
|
|
52
54
|
"sftp_username": username,
|
|
53
55
|
"sftp_key": key_path,
|
|
@@ -143,7 +145,9 @@ def push(project_root, sftp_host, sftp_username, sftp_key, sftp_password, projec
|
|
|
143
145
|
key_path = sftp_key
|
|
144
146
|
password = sftp_password
|
|
145
147
|
# Always resolve key_path to absolute path if set
|
|
148
|
+
print(f"key_path: {key_path}")
|
|
146
149
|
if key_path:
|
|
150
|
+
print(f"key_path: {key_path}")
|
|
147
151
|
key_path = os.path.abspath(os.path.expanduser(key_path))
|
|
148
152
|
if not key_path and not password:
|
|
149
153
|
if os.path.exists(DEFAULT_SSH_KEY):
|
|
@@ -104,13 +104,30 @@ def update_or_create_project_json(
|
|
|
104
104
|
save_project_json(project_json_path, data)
|
|
105
105
|
return project_json_path
|
|
106
106
|
|
|
107
|
+
def load_private_key(key_path, password=None):
|
|
108
|
+
key_loaders = [
|
|
109
|
+
paramiko.Ed25519Key.from_private_key_file,
|
|
110
|
+
paramiko.RSAKey.from_private_key_file,
|
|
111
|
+
paramiko.ECDSAKey.from_private_key_file,
|
|
112
|
+
paramiko.DSSKey.from_private_key_file,
|
|
113
|
+
]
|
|
114
|
+
last_exception = None
|
|
115
|
+
for loader in key_loaders:
|
|
116
|
+
try:
|
|
117
|
+
return loader(key_path, password=password)
|
|
118
|
+
except paramiko.ssh_exception.PasswordRequiredException:
|
|
119
|
+
raise # Key is encrypted, need password
|
|
120
|
+
except Exception as e:
|
|
121
|
+
last_exception = e
|
|
122
|
+
raise RuntimeError(f"Could not load private key: {last_exception}")
|
|
123
|
+
|
|
107
124
|
def sftp_connect(host: str, username: str, password: str = None, key_path: str = None):
|
|
108
125
|
"""
|
|
109
126
|
Establish an SFTP connection using paramiko. Returns an SFTP client.
|
|
110
127
|
"""
|
|
111
128
|
transport = paramiko.Transport((host, 22))
|
|
112
129
|
if key_path:
|
|
113
|
-
private_key =
|
|
130
|
+
private_key = load_private_key(key_path)
|
|
114
131
|
transport.connect(username=username, pkey=private_key)
|
|
115
132
|
else:
|
|
116
133
|
transport.connect(username=username, password=password)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|