addftool 0.0.4__py3-none-any.whl → 0.0.6__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/blob.py CHANGED
@@ -3,6 +3,7 @@ import requests
3
3
  import os
4
4
  import json
5
5
  import yaml
6
+ import tempfile
6
7
  from cryptography.fernet import Fernet
7
8
 
8
9
  from .util import execute_command
@@ -59,10 +60,10 @@ def install_main(args):
59
60
  args.packages = " ".join(to_install)
60
61
 
61
62
  # generate install script
62
- if args.output_script is not None:
63
- script_writer = open(args.output_script, "w")
64
- else:
65
- script_writer = None
63
+ # if args.output_script is not None:
64
+ # script_writer = open(args.output_script, "w")
65
+ # else:
66
+ script_writer = None
66
67
 
67
68
  # get ubuntu version
68
69
  ubuntu_version = get_ubuntu_version()
@@ -128,13 +129,33 @@ def mount_main(args):
128
129
  create_dir_for_current_user(args.buffer, sudo=args.sudo)
129
130
  create_dir_for_current_user(args.mount, sudo=args.sudo)
130
131
 
131
- # write config file into /tmp/config.yaml
132
+ # write config file into tempfile
132
133
 
133
- temp_config = "/tmp/config.yaml"
134
+ temp_config_dir = tempfile.mktemp()
135
+ print("Create temp config dir: ", temp_config_dir)
136
+ os.makedirs(temp_config_dir, exist_ok=True)
137
+ temp_config = os.path.join(temp_config_dir, "blobfuse2.yaml")
134
138
  with open(temp_config, 'w') as stream:
135
139
  yaml.dump(template, stream)
140
+
141
+ print("Create config file: ", temp_config)
136
142
 
137
143
  command = f"blobfuse2 mount {args.mount} --config-file={temp_config}"
144
+ if args.allow_other:
145
+ command += " --allow-other"
146
+ # to avoid "Error: fusermount3: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf"
147
+ # check if 'user_allow_other' is set in /etc/fuse.conf
148
+ exist_user_allow_other = False
149
+ with open("/etc/fuse.conf") as f:
150
+ for line in f:
151
+ if line.startswith("user_allow_other"):
152
+ exist_user_allow_other = True
153
+ break
154
+ if not exist_user_allow_other:
155
+ print("Add user_allow_other to /etc/fuse.conf")
156
+ pre_command = "echo 'user_allow_other' | sudo tee -a /etc/fuse.conf"
157
+ execute_command(pre_command)
158
+
138
159
  execute_command(command)
139
160
 
140
161
 
@@ -179,7 +200,7 @@ def main():
179
200
 
180
201
  subparsers = parser.add_subparsers(dest='command', help='Sub-command help')
181
202
  install_parser = subparsers.add_parser('install', help='Install help')
182
- install_parser.add_argument("-o", "--output_script", help="output script", default=None)
203
+ # install_parser.add_argument("-o", "--output_script", help="output script", default=None)
183
204
  install_parser.add_argument("--packages", help="packages", default="fuse3 blobfuse2 azcopy")
184
205
  install_parser.add_argument("--sudo", help="sudo", action="store_true")
185
206
 
@@ -188,6 +209,7 @@ def main():
188
209
  mount_parser.add_argument("-b", "--buffer", help="buffer dir", required=True)
189
210
  mount_parser.add_argument("-m", "--mount", help="mount dir", required=True)
190
211
  mount_parser.add_argument("-t", "--template", help="yaml template file", default=None)
212
+ mount_parser.add_argument("-o", "--allow-other", help="allow other", action="store_true", default=False)
191
213
  mount_parser.add_argument("--sudo", help="sudo", action="store_true")
192
214
 
193
215
  token_parser = subparsers.add_parser('token', help='Token help')
@@ -1,8 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: addftool
3
- Version: 0.0.4
4
- License-File: LICENSE
3
+ Version: 0.0.6
5
4
  Requires-Dist: cryptography
6
5
  Requires-Dist: requests
7
6
  Requires-Dist: PyYAML
8
-
@@ -0,0 +1,9 @@
1
+ addftool/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ addftool/blob.py,sha256=S5dk20Gn2Ne3UVkKwpI11xSTOndO1W3wVRsJrJmhNOQ,7741
3
+ addftool/tool.py,sha256=EuKQ2t2InN7yB-_oYLcdsA7vRqzRGTunwIxplUSqEG0,2054
4
+ addftool/util.py,sha256=Q3A68vJDxgfeNiEFmk54HuMuworVndocXpSbVpvGMfc,362
5
+ addftool-0.0.6.dist-info/METADATA,sha256=lNcNL-m1MkGnzmWEPZuJmf6ncJICUBZyq07HtWESqlU,126
6
+ addftool-0.0.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
+ addftool-0.0.6.dist-info/entry_points.txt,sha256=h5TlQy4AQw-J55HqI7FRkIVRUfw-x3pStFWCoYtoCTM,78
8
+ addftool-0.0.6.dist-info/top_level.txt,sha256=jqj56-plrBbyzY0tIxB6wPzjAA8kte4hUlajyyQygN4,9
9
+ addftool-0.0.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.3.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,19 +0,0 @@
1
- Copyright (c) 2018 The Python Packaging Authority
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- SOFTWARE.
@@ -1,10 +0,0 @@
1
- addftool/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- addftool/blob.py,sha256=5gdXzv_8RQOjCEo1ihsP3S3e7nrfqKWwfpxGw7pipXs,6690
3
- addftool/tool.py,sha256=EuKQ2t2InN7yB-_oYLcdsA7vRqzRGTunwIxplUSqEG0,2054
4
- addftool/util.py,sha256=Q3A68vJDxgfeNiEFmk54HuMuworVndocXpSbVpvGMfc,362
5
- addftool-0.0.4.dist-info/LICENSE,sha256=7EI8xVBu6h_7_JlVw-yPhhOZlpY9hP8wal7kHtqKT_E,1074
6
- addftool-0.0.4.dist-info/METADATA,sha256=If4J7R9OXA8e0OXs02shLes0NUmSK5pk4hsYyG48qKg,149
7
- addftool-0.0.4.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
8
- addftool-0.0.4.dist-info/entry_points.txt,sha256=h5TlQy4AQw-J55HqI7FRkIVRUfw-x3pStFWCoYtoCTM,78
9
- addftool-0.0.4.dist-info/top_level.txt,sha256=jqj56-plrBbyzY0tIxB6wPzjAA8kte4hUlajyyQygN4,9
10
- addftool-0.0.4.dist-info/RECORD,,