addftool 0.2.11__py3-none-any.whl → 0.2.14__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.
- addftool/addf_portal.py +19 -0
- addftool/blob.py +29 -6
- {addftool-0.2.11.dist-info → addftool-0.2.14.dist-info}/METADATA +1 -1
- {addftool-0.2.11.dist-info → addftool-0.2.14.dist-info}/RECORD +7 -7
- {addftool-0.2.11.dist-info → addftool-0.2.14.dist-info}/WHEEL +0 -0
- {addftool-0.2.11.dist-info → addftool-0.2.14.dist-info}/entry_points.txt +0 -0
- {addftool-0.2.11.dist-info → addftool-0.2.14.dist-info}/top_level.txt +0 -0
addftool/addf_portal.py
CHANGED
|
@@ -7,9 +7,28 @@ from addftool.sleep import add_sleep_args, sleep_main
|
|
|
7
7
|
|
|
8
8
|
from addftool.blob import add_blob_args, blob_main
|
|
9
9
|
|
|
10
|
+
# Import version information
|
|
11
|
+
try:
|
|
12
|
+
from importlib.metadata import version
|
|
13
|
+
__version__ = version("addftool")
|
|
14
|
+
except ImportError:
|
|
15
|
+
# Fallback for older Python versions
|
|
16
|
+
import pkg_resources
|
|
17
|
+
__version__ = pkg_resources.get_distribution("addftool").version
|
|
18
|
+
except:
|
|
19
|
+
# Fallback if package is not installed
|
|
20
|
+
__version__ = "0.2.11" # Keep in sync with pyproject.toml
|
|
21
|
+
|
|
10
22
|
|
|
11
23
|
def get_args():
|
|
12
24
|
parser = argparse.ArgumentParser(description="Addf's tool")
|
|
25
|
+
|
|
26
|
+
# Add version argument
|
|
27
|
+
parser.add_argument(
|
|
28
|
+
'--version', '-v',
|
|
29
|
+
action='version',
|
|
30
|
+
version=f'addftool {__version__}'
|
|
31
|
+
)
|
|
13
32
|
|
|
14
33
|
subparsers = parser.add_subparsers(dest='command', help='Sub-command help')
|
|
15
34
|
add_killer_args(subparsers)
|
addftool/blob.py
CHANGED
|
@@ -16,6 +16,8 @@ def add_api(parser):
|
|
|
16
16
|
parser.add_argument("-a", "--api", help="api url")
|
|
17
17
|
parser.add_argument("-n", "--name", help="name")
|
|
18
18
|
parser.add_argument("-c", "--container", help="container")
|
|
19
|
+
parser.add_argument("-u", "--url", type=str, default="",
|
|
20
|
+
help="blob url")
|
|
19
21
|
|
|
20
22
|
|
|
21
23
|
def get_ubuntu_version():
|
|
@@ -180,7 +182,10 @@ def mount_main(args):
|
|
|
180
182
|
|
|
181
183
|
|
|
182
184
|
def get_token(args, info=False):
|
|
183
|
-
|
|
185
|
+
if args.url and args.url != "":
|
|
186
|
+
return get_sas_token_for_blob_url(args.api, args.url, args.key, info=info)
|
|
187
|
+
else:
|
|
188
|
+
return get_sas_token(args.api, args.name, args.container, args.key, info=info)
|
|
184
189
|
|
|
185
190
|
|
|
186
191
|
# create a new function for function calling
|
|
@@ -240,7 +245,7 @@ def parse_sas_token_from_blobfuse_config(config_file):
|
|
|
240
245
|
with open(config_file, 'r') as f:
|
|
241
246
|
try:
|
|
242
247
|
config = yaml.safe_load(f)
|
|
243
|
-
if 'sas' in config["azstorage"]:
|
|
248
|
+
if 'sas' in config["azstorage"] and config["azstorage"]['mode'] == 'sas':
|
|
244
249
|
sas_token = config['azstorage']['sas']
|
|
245
250
|
if 'account-name' in config["azstorage"]:
|
|
246
251
|
account_name = config['azstorage']['account-name']
|
|
@@ -299,7 +304,7 @@ def update_blobfuse2_config(config_file, api_url, key, hour_threshold=48, view=F
|
|
|
299
304
|
is_success = False
|
|
300
305
|
try:
|
|
301
306
|
sas_token, blob_url, expiry_time = parse_sas_token_from_blobfuse_config(config_file)
|
|
302
|
-
if view:
|
|
307
|
+
if view and blob_url is not None:
|
|
303
308
|
print(f"{blob_url} expiry time: {expiry_time}")
|
|
304
309
|
return False
|
|
305
310
|
if expiry_time is not None:
|
|
@@ -315,7 +320,7 @@ def update_blobfuse2_config(config_file, api_url, key, hour_threshold=48, view=F
|
|
|
315
320
|
return is_success
|
|
316
321
|
|
|
317
322
|
|
|
318
|
-
def refresh_all_blobfuse2_configs(api_url, key, hour_threshold=48, view=False):
|
|
323
|
+
def refresh_all_blobfuse2_configs(api_url, key, hour_threshold=48, view=False, selected_mount_paths=None):
|
|
319
324
|
from addftool.process.utils import get_processes
|
|
320
325
|
if not view:
|
|
321
326
|
assert api_url is not None and key is not None, "api url and key must be provided when not in view mode"
|
|
@@ -326,7 +331,11 @@ def refresh_all_blobfuse2_configs(api_url, key, hour_threshold=48, view=False):
|
|
|
326
331
|
if arg.startswith("--config-file="):
|
|
327
332
|
config_file = arg.split("=", 1)[1]
|
|
328
333
|
break
|
|
329
|
-
|
|
334
|
+
if selected_mount_paths is not None and config_file is not None:
|
|
335
|
+
mount_path = proc['command'][2]
|
|
336
|
+
# print(f"mount_path: {mount_path}, selected_mount_paths: {selected_mount_paths}")
|
|
337
|
+
if mount_path not in selected_mount_paths:
|
|
338
|
+
continue
|
|
330
339
|
if config_file is not None:
|
|
331
340
|
state = update_blobfuse2_config(config_file, api_url, key, hour_threshold=hour_threshold, view=view)
|
|
332
341
|
if state:
|
|
@@ -334,7 +343,21 @@ def refresh_all_blobfuse2_configs(api_url, key, hour_threshold=48, view=False):
|
|
|
334
343
|
|
|
335
344
|
|
|
336
345
|
def refresh_main(args):
|
|
337
|
-
|
|
346
|
+
# only update current user's blobfuse2 configs
|
|
347
|
+
selected_mount_paths = []
|
|
348
|
+
# df -h | grep blobfuse2
|
|
349
|
+
current_user_file_systems = os.popen("df -h | grep blobfuse2").readlines()
|
|
350
|
+
for line in current_user_file_systems:
|
|
351
|
+
parts = line.split()
|
|
352
|
+
if len(parts) >= 6:
|
|
353
|
+
mount_path = parts[5]
|
|
354
|
+
selected_mount_paths.append(mount_path)
|
|
355
|
+
|
|
356
|
+
print(f"selected_mount_paths for current user: {selected_mount_paths}")
|
|
357
|
+
refresh_all_blobfuse2_configs(
|
|
358
|
+
args.api, args.key, hour_threshold=args.hour_threshold,
|
|
359
|
+
view=args.view, selected_mount_paths=selected_mount_paths,
|
|
360
|
+
)
|
|
338
361
|
|
|
339
362
|
|
|
340
363
|
def add_args(parser):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
addftool/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
addftool/addf_portal.py,sha256=
|
|
3
|
-
addftool/blob.py,sha256=
|
|
2
|
+
addftool/addf_portal.py,sha256=CnOAq3JLQjK9-OyYWDYcmtLBM68L3N6WeP5NjBod4zc,1819
|
|
3
|
+
addftool/blob.py,sha256=RzPpIrBPNKr5KS4sScHFWqsYW9tA8EY-H0fSrlmns8w,15272
|
|
4
4
|
addftool/broadcast_folder.py,sha256=GQBuSL8Ch537V_fSBHesWyqT3KRYry68pbYOKy2bDj4,19619
|
|
5
5
|
addftool/sleep.py,sha256=kykcZR2tA0ZpRUwQf6IIUdJ4dYkolyD91FdriViq9Nc,11771
|
|
6
6
|
addftool/sync.py,sha256=ZpYxbM8uiPFrV7ODmOaM7asVPCWaxBixA-arVc-1kfs,14045
|
|
@@ -13,8 +13,8 @@ addftool/deploy/vscode_server.py,sha256=tLtSvlcK2fEOaw6udWt8dNELVhwv9F59hF5DJJ-1
|
|
|
13
13
|
addftool/process/__init__.py,sha256=Dze8OrcyjQlAbPrjE_h8bMi8W4b3OJyZOjTucPrkJvM,3721
|
|
14
14
|
addftool/process/utils.py,sha256=JldxnwanLJOgxaPgmCJh7SeBRaaj5rFxWWxh1hpsvbA,2609
|
|
15
15
|
addftool/ssh/__init__.py,sha256=h5_rCO0A6q2Yw9vFguQZZp_ApAJsT1dcnKnbKKZ0cDM,4409
|
|
16
|
-
addftool-0.2.
|
|
17
|
-
addftool-0.2.
|
|
18
|
-
addftool-0.2.
|
|
19
|
-
addftool-0.2.
|
|
20
|
-
addftool-0.2.
|
|
16
|
+
addftool-0.2.14.dist-info/METADATA,sha256=zoxoB1uMObhyvZIvn3UJ8bSIZ5x8JMUdHyot0phXIGk,221
|
|
17
|
+
addftool-0.2.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
18
|
+
addftool-0.2.14.dist-info/entry_points.txt,sha256=9lkmuWMInwUAtev8w8poNkNd7iML9Bjd5CBCFVxg2b8,111
|
|
19
|
+
addftool-0.2.14.dist-info/top_level.txt,sha256=jqj56-plrBbyzY0tIxB6wPzjAA8kte4hUlajyyQygN4,9
|
|
20
|
+
addftool-0.2.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|