Skip to content

Commit 6b2a2c3

Browse files
Merge pull request #37 from HPCNow/develop
Develop
2 parents 44cb1e5 + 4a9cf23 commit 6b2a2c3

File tree

4 files changed

+66
-22
lines changed

4 files changed

+66
-22
lines changed

Diff for: README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ Froster is a user-friendly archiving tool for teams that move data between highe
1010

1111
```
1212
sudo apt-get update
13-
sudo apt-get install -y curl pipx git gcc lib32gcc-s1 unzip
13+
sudo apt-get install -y curl pipx git gcc lib32gcc-s1 unzip fuse3
1414
```
1515

1616
### On RHEL
1717

1818
```
1919
sudo yum update
20-
sudo yum install -y curl pipx git gcc lib32gcc-s1 unzip
20+
sudo yum install -y curl pipx git gcc lib32gcc-s1 unzip fuse3
2121
```
2222

2323
### On HPC machine
2424

2525
Please contact your administrator to install these packages:
2626
```
27-
curl pipx git gcc lib32gcc-s1 unzip
27+
curl pipx git gcc lib32gcc-s1 unzip fuse3
2828
```
2929

3030
</br>

Diff for: froster/froster.py

+41-18
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
from textual.widgets import DataTable, Footer, Button
6161

6262
__app__ = 'Froster, a user friendly S3/Glacier archiving tool'
63-
__version__ = '0.10.2'
63+
__version__ = '0.10.4'
6464

6565

6666
class ConfigManager:
@@ -88,7 +88,9 @@ def __init__(self):
8888
# Initialize the variables that check if specific configuration sections have been initialized
8989
self.user_init = False
9090
self.aws_init = False
91+
self.nih_init = False
9192
self.s3_init = False
93+
self.configuration_done = False
9294

9395
# Whoami
9496
self.whoami = getpass.getuser()
@@ -193,6 +195,9 @@ def __init__(self):
193195
# NIH configuration
194196
self.is_nih = config.getboolean('NIH', 'is_nih', fallback=None)
195197

198+
# Set nih init flag
199+
self.nih_init = True if self.is_nih is not None else False
200+
196201
# Current S3 Bucket name
197202
self.bucket_name = config.get(
198203
'S3', 'bucket_name', fallback=None)
@@ -241,6 +246,10 @@ def __init__(self):
241246
self.ec2_last_instance = config.get(
242247
'CLOUD', 'ec2_last_instance', fallback=None)
243248

249+
if self.user_init and self.aws_init and self.s3_init and self.nih_init:
250+
self.configuration_done = True
251+
252+
244253
def __repr__(self):
245254
''' Return a string representation of the object'''
246255

@@ -4664,26 +4673,33 @@ def convert_size(self, size_bytes):
46644673

46654674
def _archive_json_add_entry(self, key, value):
46664675
'''Add a new entry to the archive JSON file'''
4676+
try:
46674677

4668-
# Initialize the data dictionary in case archive_json does not exist
4669-
data = {}
4678+
# Initialize the data dictionary in case archive_json does not exist
4679+
data = {}
46704680

4671-
# Read the archive JSON file
4672-
if os.path.isfile(self.archive_json):
4673-
with open(self.archive_json, 'r') as file:
4674-
try:
4675-
data = json.load(file)
4676-
except:
4677-
print('Error in Archiver._archive_json_add_entry():')
4678-
print(f'Cannot read {self.archive_json}, file corrupt?')
4679-
return False
4681+
# Read the archive JSON file
4682+
if os.path.isfile(self.archive_json):
4683+
with open(self.archive_json, 'r') as file:
4684+
try:
4685+
data = json.load(file)
4686+
except:
4687+
print('Error in Archiver._archive_json_add_entry():')
4688+
print(
4689+
f'Cannot read {self.archive_json}, file corrupt?')
4690+
return
46804691

4681-
# Add the new entry to the data dictionary
4682-
data[key] = value
4692+
# Add the new entry to the data dictionary
4693+
data[key] = value
46834694

4684-
# Write the updated data dictionary to the archive JSON file
4685-
with open(self.archive_json, 'w') as file:
4686-
json.dump(data, file, indent=4)
4695+
# Create the directory for the archive JSON file if it does not exist
4696+
os.makedirs(os.path.dirname(self.archive_json), exist_ok=True)
4697+
4698+
# Write the updated data dictionary to the archive JSON file
4699+
with open(self.archive_json, 'w') as file:
4700+
json.dump(data, file, indent=4)
4701+
except:
4702+
print_error()
46874703

46884704
def _is_folder_archived(self, folder):
46894705
'''Check if an entry exists in the archive JSON file'''
@@ -5221,7 +5237,7 @@ def _run_rclone_command(self, command, background=False):
52215237

52225238
# This is the solution i found to prevent the popen subprocess to throw errors due
52235239
# our particular usage of rclone.
5224-
output = True
5240+
output = False
52255241

52265242
if output:
52275243
# Print output in stdout
@@ -6558,6 +6574,13 @@ def main():
65586574
if cfg.is_shared and cfg.shared_dir:
65596575
cfg.assure_permissions_and_group(cfg.shared_dir)
65606576

6577+
# Do not allow other commands rather than config if the configuration is not set
6578+
if not cfg.configuration_done and args.subcmd not in ['config', 'cnf']:
6579+
print('\nFroster is not full configured yet.\n')
6580+
print('Run "froster config" for a full new configuration.')
6581+
print('Run "froster config --help" for more information.\n')
6582+
sys.exit(1)
6583+
65616584
# call a function for each sub command in our CLI
65626585
if args.subcmd in ['config', 'cnf']:
65636586
subcmd_config(args, cfg, aws)

Diff for: install.sh

+21
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,19 @@ check_apt_dependencies() {
148148
echo
149149
exit 1
150150
fi
151+
152+
# Check if fuse3 is installed
153+
if [[ -z $(command -v fusermount3) ]]; then
154+
echo "Error: fusermount3 is not installed."
155+
echo
156+
echo "Please install fuse3"
157+
echo "In most linux distros you can install the latest version of fuse3 by running the following commands:"
158+
echo " sudo apt update"
159+
echo " sudo apt install -y fuse3"
160+
echo
161+
exit 1
162+
fi
163+
151164
}
152165

153166
# Backup older installations (if any) but keep the froster-archive.json and config.ini files
@@ -260,14 +273,17 @@ install_pwalk() {
260273
rm -rf ${pwalk_path} >/dev/null 2>&1
261274

262275
# Gather pwalk repository files
276+
echo " Downloading pwalk files"
263277
curl -s -L ${pwalk_repository} | tar xzf - >/dev/null 2>&1 &
264278
spinner $!
265279

266280
# Compile pwalk tool and put exec file in froster's binaries folder
281+
echo " Compiling pwalk"
267282
gcc -pthread ${pwalk_path}/pwalk.c ${pwalk_path}/exclude.c ${pwalk_path}/fileProcess.c -o ${pwalk_path}/pwalk >/dev/null 2>&1 &
268283
spinner $!
269284

270285
# Move pwalk to froster's binaries folder
286+
echo " Moving pwalk to froster's binaries folder"
271287
if [ -d "${HOME}/.local/share/pipx" ]; then
272288
mv ${pwalk_path}/pwalk ${HOME}/.local/share/pipx/venvs/froster/bin/pwalk >/dev/null 2>&1
273289
elif [ -d "${HOME}/.local/pipx" ]; then
@@ -280,6 +296,7 @@ install_pwalk() {
280296
fi
281297

282298
# Delete downloaded pwalk files
299+
echo " Cleaning up pwalk installation files"
283300
rm -rf ${pwalk_path} >/dev/null 2>&1
284301

285302
echo " ...pwalk installed"
@@ -310,14 +327,17 @@ install_rclone() {
310327
rm -rf rclone-current-linux-*.zip rclone-v*/ >/dev/null 2>&1
311328

312329
# Download the rclone zip file
330+
echo " Downloading rclone files"
313331
curl -LO $rclone_url >/dev/null 2>&1 &
314332
spinner $!
315333

316334
# Extract the zip file
335+
echo " Extracting rclone files"
317336
unzip rclone-current-linux-*.zip >/dev/null 2>&1 &
318337
spinner $!
319338

320339
# Move rclone to froster's binaries folder
340+
echo " Moving rclone to froster's binaries folder"
321341
if [ -d "${HOME}/.local/share/pipx" ]; then
322342
mv rclone-v*/rclone ${HOME}/.local/share/pipx/venvs/froster/bin/rclone >/dev/null 2>&1
323343
elif [ -d "${HOME}/.local/pipx" ]; then
@@ -330,6 +350,7 @@ install_rclone() {
330350
fi
331351

332352
# Remove the downloaded zip file
353+
echo " Cleaning up rclone installation files"
333354
rm -rf rclone-current-linux-*.zip rclone-v*/ >/dev/null 2>&1
334355

335356
echo " ...rclone installed"

Diff for: setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name='froster',
8-
version='0.10.2',
8+
version='0.10.4',
99
license='MIT',
1010
packages=find_packages(),
1111
install_requires=[

0 commit comments

Comments
 (0)