Skip to content

Commit

Permalink
Run and add ssh key to agent (#6)
Browse files Browse the repository at this point in the history
After the key is generated, automatically add it to the ssh-agent by ssh-add `~/.ssh/cscs-key`.
It used have to edit the `~/.ssh/config` to point to the `cscs-key`. If the ssh-agent contains the key, then the ssh-config file can kept simple and works charm with the new `ComputationalResourceWidget`.
  • Loading branch information
unkcpz authored Nov 2, 2023
1 parent 638d7c2 commit 2e57495
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions start.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,20 @@ def setup(self, _=None):
)
return
self.store_the_keys(*keys)

# Add the key to the ssh-agent.
self.add_key_to_ssh_agent()

self.output.value = "The keys were updated 👍"

def add_key_to_ssh_agent(self):
"""Add the key to the ssh-agent."""
subprocess.run(
["ssh-add", "-t", "1d", str(self.private_key_file)],
encoding="utf-8",
check=True,
)

def get_keys(self):
headers = {"Content-Type": "application/json", "Accept": "application/json"}

Expand Down

0 comments on commit 2e57495

Please sign in to comment.