atomicshop 2.9.27__py3-none-any.whl → 2.9.29__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 atomicshop might be problematic. Click here for more details.
- atomicshop/__init__.py +1 -1
- atomicshop/permissions.py +12 -0
- atomicshop/wrappers/dockerw/install_docker.py +38 -9
- atomicshop/wrappers/elasticsearchw/install_elastic.py +5 -1
- atomicshop/wrappers/factw/install/pre_install_and_install_before_restart.py +5 -3
- {atomicshop-2.9.27.dist-info → atomicshop-2.9.29.dist-info}/METADATA +1 -1
- {atomicshop-2.9.27.dist-info → atomicshop-2.9.29.dist-info}/RECORD +10 -10
- {atomicshop-2.9.27.dist-info → atomicshop-2.9.29.dist-info}/LICENSE.txt +0 -0
- {atomicshop-2.9.27.dist-info → atomicshop-2.9.29.dist-info}/WHEEL +0 -0
- {atomicshop-2.9.27.dist-info → atomicshop-2.9.29.dist-info}/top_level.txt +0 -0
atomicshop/__init__.py
CHANGED
atomicshop/permissions.py
CHANGED
|
@@ -29,6 +29,18 @@ def is_admin() -> bool:
|
|
|
29
29
|
return result
|
|
30
30
|
|
|
31
31
|
|
|
32
|
+
def get_ubuntu_sudo_executer_username() -> str:
|
|
33
|
+
"""
|
|
34
|
+
Function gets the username of the user who executed the script with sudo.
|
|
35
|
+
:return: str, username.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
if 'SUDO_USER' in os.environ:
|
|
39
|
+
return os.environ['SUDO_USER']
|
|
40
|
+
else:
|
|
41
|
+
return ''
|
|
42
|
+
|
|
43
|
+
|
|
32
44
|
def set_executable_permission(file_path: str):
|
|
33
45
|
"""
|
|
34
46
|
Function sets the executable permission on a file.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import subprocess
|
|
2
2
|
import getpass
|
|
3
3
|
|
|
4
|
-
from ... import process, filesystem
|
|
4
|
+
from ... import process, filesystem, permissions
|
|
5
5
|
from ...print_api import print_api
|
|
6
6
|
|
|
7
7
|
|
|
@@ -28,9 +28,40 @@ def is_docker_installed():
|
|
|
28
28
|
return False
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
def
|
|
31
|
+
def add_current_user_to_docker_group(print_kwargs: dict = None):
|
|
32
|
+
"""
|
|
33
|
+
The function will add the current user to the docker group.
|
|
34
|
+
|
|
35
|
+
:param print_kwargs: dict, the print arguments.
|
|
36
|
+
:return:
|
|
37
|
+
"""
|
|
38
|
+
# Check if current user that executed the script is a sudo user. If not, use the current user.
|
|
39
|
+
sudo_executer_username: str = permissions.get_ubuntu_sudo_executer_username()
|
|
40
|
+
if sudo_executer_username:
|
|
41
|
+
current_user = sudo_executer_username
|
|
42
|
+
else:
|
|
43
|
+
current_user = getpass.getuser()
|
|
44
|
+
|
|
45
|
+
# Add the current user to the docker group.
|
|
46
|
+
# subprocess.check_call(['sudo', 'usermod', '-aG', 'docker', current_user])
|
|
47
|
+
command = f"sudo usermod -aG docker {current_user}"
|
|
48
|
+
# Execute the command
|
|
49
|
+
subprocess.run(command, shell=True, capture_output=True, text=True)
|
|
50
|
+
|
|
51
|
+
# Check if the user was added to the docker group.
|
|
52
|
+
result = subprocess.run(['groups'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
|
53
|
+
if 'docker' in result.stdout:
|
|
54
|
+
print_api(f"User {current_user} was added to the docker group.", color='green', **(print_kwargs or {}))
|
|
55
|
+
return True
|
|
56
|
+
else:
|
|
57
|
+
print_api(f"User {current_user} was not added to the docker group.", color='red', **(print_kwargs or {}))
|
|
58
|
+
return False
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def install_docker_ubuntu(add_current_user_to_docker_group_bool: bool = True):
|
|
32
62
|
"""
|
|
33
63
|
The function will install docker on ubuntu.
|
|
64
|
+
:param add_current_user_to_docker_group_bool: bool, if True, the current user will be added to the docker group.
|
|
34
65
|
|
|
35
66
|
Usage in main.py (run with sudo):
|
|
36
67
|
from atomicshop.wrappers.dockerw import install_docker
|
|
@@ -67,17 +98,15 @@ def install_docker_ubuntu():
|
|
|
67
98
|
# sudo docker run hello-world
|
|
68
99
|
|
|
69
100
|
# Add Privileges to run docker without sudo. Add current user to Docker superuser group.
|
|
70
|
-
sudo usermod -aG docker $USER
|
|
101
|
+
# sudo usermod -aG docker $USER
|
|
71
102
|
"""
|
|
72
103
|
|
|
73
104
|
process.execute_script(script, shell=True)
|
|
74
105
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
# Execute the command
|
|
80
|
-
subprocess.run(command, shell=True, capture_output=True, text=True)
|
|
106
|
+
if add_current_user_to_docker_group_bool:
|
|
107
|
+
# Check if current user that executed the script is a sudo user. If not, use the current user.
|
|
108
|
+
# Add the current user to the docker group.
|
|
109
|
+
add_current_user_to_docker_group()
|
|
81
110
|
|
|
82
111
|
# Verify the installation.
|
|
83
112
|
result: list = process.execute_with_live_output('sudo docker run hello-world')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
|
|
3
3
|
from ...print_api import print_api
|
|
4
|
-
from ... import process
|
|
4
|
+
from ... import process, permissions
|
|
5
5
|
from .. import ubuntu_terminal
|
|
6
6
|
from . import config_basic, infrastructure
|
|
7
7
|
|
|
@@ -196,6 +196,10 @@ def install_elastic_kibana_ubuntu(install_elastic: bool = True, install_kibana:
|
|
|
196
196
|
# Install Elasticsearch.
|
|
197
197
|
ubuntu_terminal.install_packages([config_basic.UBUNTU_ELASTIC_PACKAGE_NAME])
|
|
198
198
|
|
|
199
|
+
if not permissions.is_admin():
|
|
200
|
+
print_api("This script requires root privileges...", color='red')
|
|
201
|
+
sys.exit(1)
|
|
202
|
+
|
|
199
203
|
# Check if the configuration file exists.
|
|
200
204
|
infrastructure.is_elastic_config_file_exists(exit_on_error=True, output_message=True)
|
|
201
205
|
|
|
@@ -4,7 +4,7 @@ import sys
|
|
|
4
4
|
|
|
5
5
|
from .... import permissions, filesystem
|
|
6
6
|
from ....print_api import print_api
|
|
7
|
-
from ... import githubw
|
|
7
|
+
from ... import githubw, ubuntu_terminal
|
|
8
8
|
from ...dockerw import install_docker
|
|
9
9
|
from .. import config_install
|
|
10
10
|
|
|
@@ -22,7 +22,7 @@ def install_before_restart(installation_directory: str, remove_existing_installa
|
|
|
22
22
|
|
|
23
23
|
if not permissions.is_admin():
|
|
24
24
|
print_api("This script requires root privileges...", color='red')
|
|
25
|
-
|
|
25
|
+
ubuntu_terminal.update_system_packages()
|
|
26
26
|
|
|
27
27
|
docker_keyring_file_path: str = "/etc/apt/keyrings/docker.gpg"
|
|
28
28
|
nodesource_keyring_file_path: str = "/etc/apt/keyrings/nodesource.gpg"
|
|
@@ -56,7 +56,9 @@ def install_before_restart(installation_directory: str, remove_existing_installa
|
|
|
56
56
|
|
|
57
57
|
# Install docker. FACT installs the docker, but there can be a problem with permissions, so we need to add
|
|
58
58
|
# the user permissions to the docker group before restart.
|
|
59
|
-
install_docker.
|
|
59
|
+
if not install_docker.add_current_user_to_docker_group():
|
|
60
|
+
print_api("Docker is installed, but the current user was not added to the docker group.", color='red')
|
|
61
|
+
sys.exit(1)
|
|
60
62
|
|
|
61
63
|
print_api("FACT_core installation before restart is finished.", color='green')
|
|
62
64
|
print_api("Please restart the computer to continue the installation.", color='red')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
atomicshop/__init__.py,sha256=
|
|
1
|
+
atomicshop/__init__.py,sha256=RAQCwmncU0o_AWH7w8Apgd9_IIDDk-vUclliLZt1h6c,123
|
|
2
2
|
atomicshop/_basics_temp.py,sha256=6cu2dd6r2dLrd1BRNcVDKTHlsHs_26Gpw8QS6v32lQ0,3699
|
|
3
3
|
atomicshop/_create_pdf_demo.py,sha256=Yi-PGZuMg0RKvQmLqVeLIZYadqEZwUm-4A9JxBl_vYA,3713
|
|
4
4
|
atomicshop/_patch_import.py,sha256=ENp55sKVJ0e6-4lBvZnpz9PQCt3Otbur7F6aXDlyje4,6334
|
|
@@ -22,7 +22,7 @@ atomicshop/inspect_wrapper.py,sha256=sGRVQhrJovNygHTydqJj0hxES-aB2Eg9KbIk3G31apw
|
|
|
22
22
|
atomicshop/ip_addresses.py,sha256=Hvi4TumEFoTEpKWaq5WNF-YzcRzt24IxmNgv-Mgax1s,1190
|
|
23
23
|
atomicshop/keyboard_press.py,sha256=1W5kRtOB75fulVx-uF2yarBhW0_IzdI1k73AnvXstk0,452
|
|
24
24
|
atomicshop/pbtkmultifile_argparse.py,sha256=aEk8nhvoQVu-xyfZosK3ma17CwIgOjzO1erXXdjwtS4,4574
|
|
25
|
-
atomicshop/permissions.py,sha256=
|
|
25
|
+
atomicshop/permissions.py,sha256=y63kcxU6GAmnVXqWhs_N29XorOD2xYWlK_CjZ1PpHgA,2897
|
|
26
26
|
atomicshop/print_api.py,sha256=DhbCQd0MWZZ5GYEk4oTu1opRFC-b31g1VWZgTGewG2Y,11568
|
|
27
27
|
atomicshop/process.py,sha256=SXaqG8pzNkHvppPhuhixEIXSaqbeDlTUFLaS5bYSp54,14176
|
|
28
28
|
atomicshop/process_name_cmd.py,sha256=TNAK6kQZm5JKWzEW6QLqVHEG98ZLNDQiSS4YwDk8V8c,3830
|
|
@@ -154,12 +154,12 @@ atomicshop/wrappers/certauthw/certauthw.py,sha256=4WvhjANI7Kzqrr_nKmtA8Kf7B6rute
|
|
|
154
154
|
atomicshop/wrappers/ctyping/process_winapi.py,sha256=QcXL-ETtlSSkoT8F7pYle97ubGWsjYp8cx8HxkVMgAc,2762
|
|
155
155
|
atomicshop/wrappers/dockerw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
156
156
|
atomicshop/wrappers/dockerw/dockerw.py,sha256=w8zSJr5C7cbvbuG09ORCpAe0BOcibqqL_Z2EKEBHYK4,6266
|
|
157
|
-
atomicshop/wrappers/dockerw/install_docker.py,sha256=
|
|
157
|
+
atomicshop/wrappers/dockerw/install_docker.py,sha256=2dC1yccpOTqYbQK8t4HfzHmu5IvjAnUoqpzd21438xU,4742
|
|
158
158
|
atomicshop/wrappers/elasticsearchw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
159
159
|
atomicshop/wrappers/elasticsearchw/config_basic.py,sha256=XJMKKfDrUq9ZKxYnQ-xFJxSA51z31Nn4eB8_n_hryVk,800
|
|
160
160
|
atomicshop/wrappers/elasticsearchw/elasticsearchw.py,sha256=7TqFdEFznO8NlligJhEKk1vm641ALpCYdaRl1uoXdzM,9768
|
|
161
161
|
atomicshop/wrappers/elasticsearchw/infrastructure.py,sha256=J1hKIEQA8ImRUmkM25fbmwHbZPC9VnT9NK1_kOfXitA,8311
|
|
162
|
-
atomicshop/wrappers/elasticsearchw/install_elastic.py,sha256=
|
|
162
|
+
atomicshop/wrappers/elasticsearchw/install_elastic.py,sha256=3mxtNx8IXOC1sVu6xL-4N7kcd71x7LUu6tm1bz-hpTA,8479
|
|
163
163
|
atomicshop/wrappers/elasticsearchw/queries/__init__.py,sha256=KBjT-bAt75CJsx1Apko9mpuFU4pfZV8DcGWQvpX65RU,78
|
|
164
164
|
atomicshop/wrappers/elasticsearchw/queries/aggregation.py,sha256=N9a5yMMnb10sMa_x1qJBFQpgyJ49UWo8_vxuqmUtZ1A,1742
|
|
165
165
|
atomicshop/wrappers/elasticsearchw/queries/info.py,sha256=P_VhhBo8MvRI4Shi-bh4RsYtlYNRKRBzScXPC64Up_Q,2900
|
|
@@ -177,7 +177,7 @@ atomicshop/wrappers/factw/fact_extractor/docker_image.py,sha256=jJAoJNQ4aoATjn3x
|
|
|
177
177
|
atomicshop/wrappers/factw/fact_extractor/get_extractor.py,sha256=2mfOAftHIlCcGt1s7MWdq7DsDCuI6wX3MtvcEZ4SK-0,756
|
|
178
178
|
atomicshop/wrappers/factw/install/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
179
179
|
atomicshop/wrappers/factw/install/install_after_restart.py,sha256=roM1W2hkDynpEKda55xd7AsZxodsFj8i4wmFGt_HHzA,1558
|
|
180
|
-
atomicshop/wrappers/factw/install/pre_install_and_install_before_restart.py,sha256=
|
|
180
|
+
atomicshop/wrappers/factw/install/pre_install_and_install_before_restart.py,sha256=WyMlj9V3YAd2h0ymznJAKDHOx_F7_fipAmbVzsG_fak,3065
|
|
181
181
|
atomicshop/wrappers/factw/postgresql/__init__.py,sha256=xMBn2d3Exo23IPP2F_9-SXmOlhFbwWDgS9KwozSTjA0,162
|
|
182
182
|
atomicshop/wrappers/factw/postgresql/analysis.py,sha256=2Rxzy2jyq3zEKIo53z8VkjuslKE_i5mq2ZpmJAvyd6U,716
|
|
183
183
|
atomicshop/wrappers/factw/postgresql/file_object.py,sha256=VRiCXnsd6yDbnsE-TEKYPC-gkAgFVkE6rygRrJLQShI,713
|
|
@@ -230,8 +230,8 @@ atomicshop/wrappers/socketw/socket_server_tester.py,sha256=AhpurHJmP2kgzHaUbq5ey
|
|
|
230
230
|
atomicshop/wrappers/socketw/socket_wrapper.py,sha256=aXBwlEIJhFT0-c4i8iNlFx2It9VpCEpsv--5Oqcpxao,11624
|
|
231
231
|
atomicshop/wrappers/socketw/ssl_base.py,sha256=k4V3gwkbq10MvOH4btU4onLX2GNOsSfUAdcHmL1rpVE,2274
|
|
232
232
|
atomicshop/wrappers/socketw/statistics_csv.py,sha256=t3dtDEfN47CfYVi0CW6Kc2QHTEeZVyYhc57IYYh5nmA,826
|
|
233
|
-
atomicshop-2.9.
|
|
234
|
-
atomicshop-2.9.
|
|
235
|
-
atomicshop-2.9.
|
|
236
|
-
atomicshop-2.9.
|
|
237
|
-
atomicshop-2.9.
|
|
233
|
+
atomicshop-2.9.29.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
|
|
234
|
+
atomicshop-2.9.29.dist-info/METADATA,sha256=X6u20qhtlgrm_5xuM8uzH7sLn_d5uJgOQ95qOrmJtX8,10423
|
|
235
|
+
atomicshop-2.9.29.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
236
|
+
atomicshop-2.9.29.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
|
|
237
|
+
atomicshop-2.9.29.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|