forked from jyejare/candore
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from hussh import Connection | ||
from functools import cached_property | ||
from candore.config import candore_settings | ||
from urllib.parse import urlparse | ||
|
||
|
||
class Session: | ||
|
||
def __init__(self): | ||
self.settings = candore_settings() | ||
self.hostname = urlparse(self.settings.candore.base_url).hostname | ||
self.username = self.settings.candore.ssh.username or 'root' | ||
|
||
@cached_property | ||
def auth(self): | ||
auth_kwargs = {} | ||
if self.settings.candore.ssh.private_key: | ||
auth_kwargs["private_key"] = self.settings.candore.ssh.private_key | ||
elif self.settings.candore.ssh.password: | ||
auth_kwargs["password"] = self.settings.candore.ssh.password | ||
return auth_kwargs | ||
|
||
def __enter__(self): | ||
self.client = Connection(self.hostname, username=self.username, **self.auth) | ||
return self.client | ||
|
||
def __exit__(self, exc_type, exc_val, exc_tb): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
rpms: | ||
regex_pattern: '([a-zA-Z0-9_-]+)-([\d._-]+)\.(.*?)$' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ dependencies = [ | |
"flask", | ||
"requests", | ||
"PyYAML", | ||
"hussh", | ||
] | ||
|
||
[project.optional-dependencies] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters