machineconfig 2.7__py3-none-any.whl → 2.9__py3-none-any.whl
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.
Potentially problematic release.
This version of machineconfig might be problematic. Click here for more details.
- machineconfig/jobs/python/check_installations.py +0 -2
- machineconfig/jobs/python/python_ve_symlink.py +1 -1
- machineconfig/scripts/python/__pycache__/devops.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_agents.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/repos_helper_record.cpython-313.pyc +0 -0
- machineconfig/scripts/python/devops.py +18 -64
- machineconfig/scripts/python/devops_add_identity.py +6 -2
- machineconfig/scripts/python/devops_add_ssh_key.py +5 -2
- machineconfig/scripts/python/devops_backup_retrieve.py +3 -15
- machineconfig/scripts/python/devops_devapps_install.py +22 -8
- machineconfig/scripts/python/devops_update_repos.py +125 -226
- machineconfig/scripts/python/fire_agents.py +108 -151
- machineconfig/scripts/python/fire_agents_help_launch.py +97 -0
- machineconfig/scripts/python/fire_agents_help_search.py +83 -0
- machineconfig/scripts/python/helpers/cloud_helpers.py +2 -5
- machineconfig/scripts/python/repos.py +1 -1
- machineconfig/scripts/python/repos_helper_record.py +82 -5
- machineconfig/scripts/python/repos_helper_update.py +288 -0
- machineconfig/utils/installer_utils/installer_class.py +3 -3
- machineconfig/utils/notifications.py +24 -4
- machineconfig/utils/path.py +2 -1
- machineconfig/utils/procs.py +50 -35
- machineconfig/utils/source_of_truth.py +2 -0
- machineconfig/utils/ssh.py +29 -7
- {machineconfig-2.7.dist-info → machineconfig-2.9.dist-info}/METADATA +7 -11
- {machineconfig-2.7.dist-info → machineconfig-2.9.dist-info}/RECORD +30 -26
- {machineconfig-2.7.dist-info → machineconfig-2.9.dist-info}/WHEEL +0 -0
- {machineconfig-2.7.dist-info → machineconfig-2.9.dist-info}/entry_points.txt +0 -0
- {machineconfig-2.7.dist-info → machineconfig-2.9.dist-info}/top_level.txt +0 -0
|
@@ -11,8 +11,6 @@ import platform
|
|
|
11
11
|
# # from rich.progress import track
|
|
12
12
|
from machineconfig.utils.source_of_truth import LIBRARY_ROOT
|
|
13
13
|
# from machineconfig.utils.installer import get_installed_cli_apps
|
|
14
|
-
|
|
15
|
-
# from tqdm import tqdm
|
|
16
14
|
# from typing import Optional
|
|
17
15
|
# from datetime import datetime
|
|
18
16
|
# import csv
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
from machineconfig.utils.options import display_options
|
|
4
4
|
|
|
5
|
-
from machineconfig.utils.code import write_shell_script_to_default_program_path
|
|
6
5
|
from platform import system
|
|
7
6
|
from enum import Enum
|
|
8
7
|
from typing import Optional
|
|
9
8
|
from rich.console import Console
|
|
10
9
|
from rich.panel import Panel
|
|
11
|
-
from rich import box # Import box
|
|
12
10
|
|
|
13
11
|
console = Console()
|
|
14
12
|
|
|
@@ -31,11 +29,8 @@ class Options(Enum):
|
|
|
31
29
|
|
|
32
30
|
|
|
33
31
|
def args_parser():
|
|
34
|
-
# Print header
|
|
35
32
|
console.print(Panel("🛠️ DevOps Tool Suite", title_align="left", border_style="blue", width=BOX_WIDTH))
|
|
36
|
-
|
|
37
33
|
import argparse
|
|
38
|
-
|
|
39
34
|
parser = argparse.ArgumentParser()
|
|
40
35
|
new_line = "\n\n"
|
|
41
36
|
parser.add_argument("-w", "--which", help=f"""which option to run\nChoose one of those:\n{new_line.join([f"{item.name}: {item.value}" for item in list(Options)])}""", type=str, default=None) # , choices=[op.value for op in Options]
|
|
@@ -43,36 +38,8 @@ def args_parser():
|
|
|
43
38
|
main(which=args.which)
|
|
44
39
|
|
|
45
40
|
|
|
46
|
-
def display_title(title: str) -> None:
|
|
47
|
-
console.print(Panel(title, box=box.DOUBLE_EDGE, title_align="left")) # Replace print with Panel
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def display_task_title(title: str) -> None:
|
|
51
|
-
console.print(Panel(title, box=box.ROUNDED, title_align="left")) # Replace print with Panel
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def display_task_status(status: str) -> None:
|
|
55
|
-
console.print(Panel(status, box=box.ROUNDED, title_align="left")) # Replace print with Panel
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
def display_task_result(result: str) -> None:
|
|
59
|
-
console.print(Panel(result, box=box.ROUNDED, title_align="left")) # Replace print with Panel
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def display_task_error(error: str) -> None:
|
|
63
|
-
console.print(Panel(error, box=box.ROUNDED, border_style="red", title_align="left")) # Replace print with Panel
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
def display_task_warning(warning: str) -> None:
|
|
67
|
-
console.print(Panel(warning, box=box.ROUNDED, border_style="yellow", title_align="left")) # Replace print with Panel
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
def display_task_success(success: str) -> None:
|
|
71
|
-
console.print(Panel(success, box=box.ROUNDED, border_style="green", title_align="left")) # Replace print with Panel
|
|
72
|
-
|
|
73
|
-
|
|
74
41
|
def main(which: Optional[str] = None):
|
|
75
|
-
# PathExtended(
|
|
42
|
+
# PathExtended(_program_PATH).delete(sure=True, verbose=False)
|
|
76
43
|
console.print(Panel("🚀 Initializing DevOps operation...", width=BOX_WIDTH, border_style="blue"))
|
|
77
44
|
options = [op.value for op in Options]
|
|
78
45
|
if which is None:
|
|
@@ -89,31 +56,27 @@ def main(which: Optional[str] = None):
|
|
|
89
56
|
if choice_key == Options.update.value:
|
|
90
57
|
console.print(Panel("🔄 Updating essential repositories...", width=BOX_WIDTH, border_style="blue"))
|
|
91
58
|
import machineconfig.scripts.python.devops_update_repos as helper
|
|
92
|
-
|
|
59
|
+
helper.main()
|
|
93
60
|
elif choice_key == Options.cli_install.value:
|
|
94
61
|
console.print(Panel("⚙️ Installing development applications...", width=BOX_WIDTH, border_style="blue"))
|
|
95
62
|
import machineconfig.scripts.python.devops_devapps_install as helper
|
|
96
|
-
|
|
97
|
-
program = helper.main()
|
|
63
|
+
helper.main()
|
|
98
64
|
|
|
99
65
|
elif choice_key == Options.sym_new.value:
|
|
100
66
|
console.print(Panel("🔄 Creating new symlinks...", width=BOX_WIDTH, border_style="blue"))
|
|
101
67
|
import machineconfig.jobs.python.python_ve_symlink as helper
|
|
102
|
-
|
|
103
|
-
program = helper.main()
|
|
68
|
+
helper.main()
|
|
104
69
|
|
|
105
70
|
elif choice_key == Options.sym_path_shell.value:
|
|
106
71
|
console.print(Panel("🔗 Setting up symlinks, PATH, and shell profile...", width=BOX_WIDTH, border_style="blue"))
|
|
107
72
|
import machineconfig.profile.create as helper
|
|
108
|
-
|
|
109
73
|
helper.main()
|
|
110
|
-
|
|
74
|
+
"echo '✅ done with symlinks'"
|
|
111
75
|
|
|
112
76
|
elif choice_key == Options.ssh_add_pubkey.value:
|
|
113
77
|
console.print(Panel("🔑 Adding public SSH key to this machine...", width=BOX_WIDTH, border_style="blue"))
|
|
114
78
|
import machineconfig.scripts.python.devops_add_ssh_key as helper
|
|
115
|
-
|
|
116
|
-
program = helper.main()
|
|
79
|
+
helper.main()
|
|
117
80
|
|
|
118
81
|
elif choice_key == Options.ssh_use_pair.value:
|
|
119
82
|
console.print(Panel("❌ ERROR: Not Implemented\nSSH key pair connection feature is not yet implemented", title_align="left", border_style="red", width=BOX_WIDTH))
|
|
@@ -122,47 +85,38 @@ def main(which: Optional[str] = None):
|
|
|
122
85
|
elif choice_key == Options.ssh_add_id.value: # so that you can SSH directly withuot pointing to identity key.
|
|
123
86
|
console.print(Panel("🗝️ Adding SSH identity (private key) to this machine...", width=BOX_WIDTH, border_style="blue"))
|
|
124
87
|
import machineconfig.scripts.python.devops_add_identity as helper
|
|
125
|
-
|
|
126
|
-
program = helper.main()
|
|
88
|
+
helper.main()
|
|
127
89
|
|
|
128
90
|
elif choice_key == Options.ssh_setup.value:
|
|
129
91
|
console.print(Panel("📡 Setting up SSH...", width=BOX_WIDTH, border_style="blue"))
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
92
|
+
_program_windows = """Invoke-WebRequest https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_windows/openssh_all.ps1 | Invoke-Expression # https://github.com/thisismygitrepo.keys"""
|
|
93
|
+
_program_linux = """curl https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_linux/openssh_all.sh | sudo bash # https://github.com/thisismygitrepo.keys"""
|
|
94
|
+
_program_linux if system() == "Linux" else _program_windows
|
|
95
|
+
import subprocess
|
|
96
|
+
subprocess.run(_program_linux if system() == "Linux" else _program_windows, shell=True, check=True)
|
|
133
97
|
|
|
134
98
|
elif choice_key == Options.ssh_setup_wsl.value:
|
|
135
99
|
console.print(Panel("🐧 Setting up SSH for WSL...", width=BOX_WIDTH, border_style="blue"))
|
|
136
|
-
|
|
100
|
+
"""curl https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_linux/openssh_wsl.sh | sudo bash"""
|
|
137
101
|
|
|
138
102
|
elif choice_key == Options.backup.value:
|
|
139
103
|
console.print(Panel("💾 Creating backup...", width=BOX_WIDTH, border_style="blue"))
|
|
140
|
-
from machineconfig.scripts.python.devops_backup_retrieve import main_backup_retrieve
|
|
141
|
-
|
|
142
|
-
program = helper(direction="BACKUP")
|
|
104
|
+
from machineconfig.scripts.python.devops_backup_retrieve import main_backup_retrieve
|
|
105
|
+
main_backup_retrieve(direction="BACKUP")
|
|
143
106
|
|
|
144
107
|
elif choice_key == Options.retreive.value:
|
|
145
108
|
console.print(Panel("📥 Retrieving backup...", width=BOX_WIDTH, border_style="blue"))
|
|
146
|
-
from machineconfig.scripts.python.devops_backup_retrieve import main_backup_retrieve
|
|
147
|
-
|
|
148
|
-
program = helper(direction="RETRIEVE")
|
|
109
|
+
from machineconfig.scripts.python.devops_backup_retrieve import main_backup_retrieve
|
|
110
|
+
main_backup_retrieve(direction="RETRIEVE")
|
|
149
111
|
|
|
150
112
|
elif choice_key == Options.scheduler.value:
|
|
151
113
|
console.print(Panel("⏰ Setting up scheduler...", width=BOX_WIDTH, border_style="blue"))
|
|
152
114
|
# from machineconfig.scripts.python.scheduler import main as helper
|
|
153
|
-
#
|
|
154
|
-
program = ""
|
|
115
|
+
# helper()
|
|
155
116
|
|
|
156
117
|
else:
|
|
157
118
|
console.print(Panel("❌ ERROR: Invalid choice", title_align="left", border_style="red", width=BOX_WIDTH))
|
|
158
119
|
raise ValueError(f"Unimplemented choice: {choice_key}")
|
|
159
120
|
|
|
160
|
-
if program:
|
|
161
|
-
console.print(Panel("📜 Preparing shell script...", width=BOX_WIDTH, border_style="blue"))
|
|
162
|
-
write_shell_script_to_default_program_path(program=program, display=True, preserve_cwd=True, desc="🔧 Shell script prepared by Python.", execute=True if which is not None else False)
|
|
163
|
-
else:
|
|
164
|
-
write_shell_script_to_default_program_path(program="echo '✨ Done.'", display=False, desc="🔧 Shell script prepared by Python.", preserve_cwd=True, execute=False)
|
|
165
|
-
|
|
166
|
-
|
|
167
121
|
if __name__ == "__main__":
|
|
168
122
|
args_parser()
|
|
@@ -9,7 +9,7 @@ from rich.text import Text
|
|
|
9
9
|
BOX_WIDTH = 150 # width for box drawing
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
def main():
|
|
12
|
+
def main() -> None:
|
|
13
13
|
title = "🔑 SSH IDENTITY MANAGEMENT"
|
|
14
14
|
print(Panel(Text(title, justify="center"), expand=False))
|
|
15
15
|
|
|
@@ -77,7 +77,11 @@ def main():
|
|
|
77
77
|
success_message = f"🎉 CONFIGURATION SUCCESSFUL\nIdentity added: {path_to_key.name}\nConfig file: {config_path}"
|
|
78
78
|
print(Panel(Text(success_message, justify="center"), expand=False, border_style="green"))
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
import subprocess
|
|
81
|
+
# run program
|
|
82
|
+
subprocess.run(program, shell=True, check=True, text=True)
|
|
83
|
+
print(Panel("🔐 Identity added to SSH agent", expand=False, border_style="green"))
|
|
84
|
+
return None
|
|
81
85
|
|
|
82
86
|
|
|
83
87
|
if __name__ == "__main__":
|
|
@@ -68,7 +68,7 @@ sudo service ssh --full-restart
|
|
|
68
68
|
return program
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
def main():
|
|
71
|
+
def main() -> None:
|
|
72
72
|
console.print(Panel("🔐 SSH PUBLIC KEY AUTHORIZATION TOOL", box=box.DOUBLE_EDGE, title_align="left"))
|
|
73
73
|
|
|
74
74
|
console.print(Panel("🔍 Searching for public keys...", title="[bold blue]SSH Setup[/bold blue]", border_style="blue"))
|
|
@@ -111,7 +111,10 @@ def main():
|
|
|
111
111
|
|
|
112
112
|
console.print(Panel("🚀 SSH KEY AUTHORIZATION READY\nRun the generated script to apply changes", box=box.DOUBLE_EDGE, title_align="left"))
|
|
113
113
|
|
|
114
|
-
return program
|
|
114
|
+
# return program
|
|
115
|
+
import subprocess
|
|
116
|
+
subprocess.run(program, shell=True, check=True)
|
|
117
|
+
console.print(Panel("✅ SSH KEY AUTHORIZATION COMPLETED", box=box.DOUBLE_EDGE, title_align="left"))
|
|
115
118
|
|
|
116
119
|
|
|
117
120
|
if __name__ == "__main__":
|
|
@@ -16,7 +16,7 @@ from rich.panel import Panel
|
|
|
16
16
|
OPTIONS = Literal["BACKUP", "RETRIEVE"]
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
def main_backup_retrieve(direction: OPTIONS, which: Optional[str] = None):
|
|
19
|
+
def main_backup_retrieve(direction: OPTIONS, which: Optional[str] = None) -> None:
|
|
20
20
|
console = Console()
|
|
21
21
|
|
|
22
22
|
try:
|
|
@@ -73,20 +73,8 @@ def main_backup_retrieve(direction: OPTIONS, which: Optional[str] = None):
|
|
|
73
73
|
console.print(Panel("🔒 SPECIAL HANDLING: SSH PERMISSIONS\n🛠️ Setting secure permissions for SSH files\n📝 Command: chmod 700 ~/.ssh/*", title="[bold blue]Special Handling: SSH Permissions[/bold blue]", border_style="blue"))
|
|
74
74
|
print_code(program, lexer="shell", desc=f"{direction} script")
|
|
75
75
|
console.print(Panel(f"✅ {direction} SCRIPT GENERATION COMPLETE\n🚀 Ready to execute the operations", title="[bold green]Script Generation Complete[/bold green]", border_style="green"))
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
def main(direction: OPTIONS, which: Optional[str] = None):
|
|
80
|
-
console = Console()
|
|
81
|
-
|
|
82
|
-
console.print(Panel(f"🔄 {direction} OPERATION STARTED\n⏱️ {'-' * 58}", title="[bold blue]Operation Initiated[/bold blue]", border_style="blue"))
|
|
83
|
-
|
|
84
|
-
code = main_backup_retrieve(direction=direction, which=which)
|
|
85
|
-
from machineconfig.utils.code import write_shell_script_to_default_program_path
|
|
86
|
-
|
|
87
|
-
console.print(Panel("💾 GENERATING SHELL SCRIPT\n📄 Filename: backup_retrieve.sh", title="[bold blue]Shell Script Generation[/bold blue]", border_style="blue"))
|
|
88
|
-
|
|
89
|
-
write_shell_script_to_default_program_path(program=code, desc="backup_retrieve.sh", preserve_cwd=True, display=True, execute=False)
|
|
76
|
+
import subprocess
|
|
77
|
+
subprocess.run(program, shell=True, check=True)
|
|
90
78
|
|
|
91
79
|
|
|
92
80
|
if __name__ == "__main__":
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# import subprocess
|
|
4
4
|
from machineconfig.utils.installer_utils.installer_class import Installer
|
|
5
|
-
from
|
|
5
|
+
from rich.progress import Progress, SpinnerColumn, TextColumn
|
|
6
6
|
from machineconfig.utils.source_of_truth import LIBRARY_ROOT
|
|
7
7
|
from machineconfig.utils.options import choose_multiple_options
|
|
8
8
|
from machineconfig.utils.installer import get_installers, install_all, get_all_dicts
|
|
@@ -13,12 +13,12 @@ from typing import Any, Optional, Literal, TypeAlias, get_args
|
|
|
13
13
|
WHICH_CAT: TypeAlias = Literal["AllEssentials", "EssentialsAndOthers", "SystemInstallers", "PrecheckedCloudInstaller"]
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
def main(which: Optional[WHICH_CAT | str] = None):
|
|
16
|
+
def main(which: Optional[WHICH_CAT | str] = None) -> None:
|
|
17
17
|
if which is not None and which in get_args(WHICH_CAT): # install by category
|
|
18
18
|
return get_programs_by_category(program_name=which) # type: ignore
|
|
19
19
|
|
|
20
20
|
if which is not None: # install by name
|
|
21
|
-
|
|
21
|
+
total_messages: list[str] = []
|
|
22
22
|
for a_which in which.split(",") if type(which) == str else which:
|
|
23
23
|
kv = {}
|
|
24
24
|
for _category, v in get_all_dicts(system=system()).items():
|
|
@@ -32,13 +32,26 @@ def main(which: Optional[WHICH_CAT | str] = None):
|
|
|
32
32
|
installer = Installer.from_dict(name=a_which, d=kv[a_which])
|
|
33
33
|
print(installer)
|
|
34
34
|
program = installer.install_robust(version=None) # finish the task
|
|
35
|
-
program
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
total_messages.append(program)
|
|
36
|
+
for a_message in total_messages:
|
|
37
|
+
print(a_message)
|
|
38
|
+
return None
|
|
38
39
|
|
|
39
40
|
# interactive installation
|
|
40
41
|
installers = [Installer.from_dict(d=vd, name=name) for __kat, vds in get_all_dicts(system=system()).items() for name, vd in vds.items()]
|
|
41
|
-
|
|
42
|
+
|
|
43
|
+
# Check installed programs with progress indicator
|
|
44
|
+
with Progress(
|
|
45
|
+
SpinnerColumn(),
|
|
46
|
+
TextColumn("[progress.description]{task.description}"),
|
|
47
|
+
) as progress:
|
|
48
|
+
task = progress.add_task("✅ Checking installed programs...", total=len(installers))
|
|
49
|
+
options = []
|
|
50
|
+
for x in installers:
|
|
51
|
+
options.append(x.get_description())
|
|
52
|
+
progress.update(task, advance=1)
|
|
53
|
+
|
|
54
|
+
options += list(get_args(WHICH_CAT))
|
|
42
55
|
# print("s"*1000)
|
|
43
56
|
program_names = choose_multiple_options(msg="", options=options, header="🚀 CHOOSE DEV APP", default="AllEssentials")
|
|
44
57
|
|
|
@@ -53,7 +66,8 @@ def main(which: Optional[WHICH_CAT | str] = None):
|
|
|
53
66
|
else:
|
|
54
67
|
an_installer = installers[options.index(a_program_name)]
|
|
55
68
|
total_program += "\n" + an_installer.install_robust(version=None) # finish the task
|
|
56
|
-
|
|
69
|
+
import subprocess
|
|
70
|
+
subprocess.run(total_program, shell=True, check=True)
|
|
57
71
|
|
|
58
72
|
|
|
59
73
|
def get_programs_by_category(program_name: WHICH_CAT):
|