Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
5d0fae1
add system test: test_blackbox
FedeDR Sep 1, 2014
4b6ec10
temporary client_daemon refuse fix
FedeDR Sep 1, 2014
cecf8d5
add file for flexible environment for system test (in progress)
FedeDR Sep 3, 2014
984344c
Merge branch 'master' of github.com:corso-python-prato/share-system-t…
FedeDR Sep 5, 2014
9d1820a
Merge branch 'master' of github.com:corso-python-prato/share-system-t…
FedeDR Sep 9, 2014
4a1cb8f
add init base structure creation
FedeDR Sep 9, 2014
d1db121
add method for add user daemon istance
FedeDR Sep 9, 2014
992c352
add methon for daemoin istance structure and configure propagation
FedeDR Sep 9, 2014
974100d
import for usarname checker error
FedeDR Sep 9, 2014
fc353fb
add manage process function
FedeDR Sep 9, 2014
7f1d81d
minor docstring refactor
FedeDR Sep 9, 2014
749304a
DirSnapshotManager take share dir by argument
FedeDR Sep 15, 2014
1f36923
fix test for json message reading
FedeDR Sep 15, 2014
ed67624
fix import and server check password
FedeDR Sep 15, 2014
a19bb0f
fix default folder argument
FedeDR Sep 15, 2014
e586bcf
add_daemon_istance create config folder, check and init istance dict …
FedeDR Sep 15, 2014
a8be5b0
istance propagation method refactoring
FedeDR Sep 15, 2014
77e2df7
fix terminate proc pid error
FedeDR Sep 15, 2014
49bad7b
fix daemon command creation
FedeDR Sep 15, 2014
2fe6b6b
delete useless creation and init refuse
FedeDR Sep 15, 2014
40ab9af
sync share methon for set parameter before propagation
FedeDR Sep 15, 2014
71d8939
add random file method to specific folder
FedeDR Sep 15, 2014
2e35883
add start all and stop all method
FedeDR Sep 16, 2014
dc795be
add flush method for remove all environment test file
FedeDR Sep 16, 2014
2b1f578
add docstring
FedeDR Sep 16, 2014
70257cb
fix relative path problem
FedeDR Sep 19, 2014
c8c9bbc
add method for adding custom folder
FedeDR Sep 19, 2014
362baea
create a dedicated unittest class for system test
FedeDR Sep 19, 2014
7b21536
fix for refuse in utility function
FedeDR Sep 19, 2014
727288c
add a check propagation system in unittest method
FedeDR Sep 19, 2014
62bfca5
add get_share_path utility
FedeDR Sep 19, 2014
e57406d
minor test enviromnent fix
FedeDR Sep 23, 2014
38beb6c
docstring and user interface print refactor
FedeDR Sep 23, 2014
7ee4efb
delete old test structure and refactor test to new testenvironment
FedeDR Sep 23, 2014
aadc35c
Merge branch 'master' of github.com:corso-python-prato/share-system-t…
FedeDR Sep 23, 2014
fea0bb7
fix merge problem
FedeDR Sep 24, 2014
dad55c8
add parameter for test_new_client issue
FedeDR Sep 24, 2014
523030d
Merge branch 'master' of github.com:corso-python-prato/share-system-t…
FedeDR Sep 24, 2014
36a231b
FIX client_daemon download system
FedeDR Sep 24, 2014
9efb6f3
revert test refuse correction
FedeDR Sep 24, 2014
f77f6e7
fix server folder creation problem
FedeDR Sep 24, 2014
763adca
change variable name to prevent nomenclature mistake
FedeDR Nov 28, 2014
b2a016c
fix adapter form
FedeDR Nov 28, 2014
666ecfe
fix some typo error
FedeDR Nov 28, 2014
3efe9c0
some code optimization
FedeDR Dec 1, 2014
b6b2b8b
verbose use of function in test
FedeDR Dec 1, 2014
7d3c172
Merge branch 'master' of github.com:corso-python-prato/share-system-t…
FedeDR Dec 1, 2014
9f4e3f8
refactor instance inizialization
FedeDR Dec 1, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions client/client_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def download_file(self, dst_path):
local_path = get_abspath(dst_path)

if r.status_code == requests.codes.ok:
return local_path, r.text
return local_path, r.content
else:
return False, False

Expand Down Expand Up @@ -899,13 +899,14 @@ def on_modified(self, event):
class DirSnapshotManager(object):
"""This class has the responsibility to synchronize client and server"""

def __init__(self, snapshot_file_path):
def __init__(self, snapshot_file_path, share_path):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non è un po ambiguo chiamarla share_path ? sembra la path della cartella dello share e non della cartella di rawbox no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non ho capito la differenza tra cartella dello share e quella di rawbox...
ho usato il termine share_path per definire la cartella con i file dell'utente che viene sincronizzata col server. Bene o male ho seguito questa terminologia per tutto il codice

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

share_path sembra "RawBox/shares" a meno a me XD l'importante è essere coerenti, nel resto del demone non compare mai share_path, la path di rawbox viene chiamata dir_path, se vuoi cambiarla rinominala ovunque, però secondo me a quel punto è meglio rawbox_dir_path perche abbiamo anche una cartella shares e share_path può essere forviante per quello.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cambiato nomenclatura

"""The constructor.
It loads the last global snapshot and creates an instant snapshot
of local directory.
@param snapshot_file_path Path of the snapshot
"""
self.snapshot_file_path = snapshot_file_path
self.share_path = share_path
self.last_status = self._load_status()
self.local_full_snapshot = self.instant_snapshot()

Expand Down Expand Up @@ -966,7 +967,7 @@ def instant_snapshot(self):
@return The snapshot of the directory
"""
dir_snapshot = {}
for root, dirs, files in os.walk(CONFIG_DIR_PATH):
for root, dirs, files in os.walk(self.share_path):
for f in files:
full_path = os.path.join(root, f)
file_md5 = self.file_snapMd5(full_path)
Expand Down Expand Up @@ -1161,7 +1162,7 @@ def synchronize_dispatcher(self, server_timestamp, server_snapshot):

for equal_path in equal_paths: # 2) b 2
if self.find_file_md5(
self.local_full_snapshot, equal_path, False) != self.find_file_md5(server_snapshot, equal_path):
self.local_full_snapshot, equal_path, False) != self.find_file_md5(server_snapshot, equal_path):
if self.check_files_timestamp(server_snapshot, equal_path): # 2) b 2 I
logger.debug("server push:\t{}".format(equal_path))
command_list.append({'remote_upload': [equal_path]})
Expand Down Expand Up @@ -1264,15 +1265,16 @@ def args_parse_init(stdout_level, file_level):
@param stdout_level
@param file_level
"""
parser = argparse.ArgumentParser(description='RawBox client daemon',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--std-log-level", required=False,
parser = argparse.ArgumentParser(
description='RawBox client daemon',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--std-log-level", required=False,
help="set the logging level to std out. this argument accept:\n\tDEBUG\n\tINFO\n\tWARNING\n\tERROR\n\tCRITICAL", default=stdout_level)
parser.add_argument("--file-log-level", required=False,
parser.add_argument("--file-log-level", required=False,
help="set the logging level to file. this argument accept:\n\tDEBUG\n\tINFO\n\tWARNING\n\tERROR\n\tCRITICAL", default=file_level)
parser.add_argument("--no-log", action="store_true", required=False,
parser.add_argument("--no-log", action="store_true", required=False,
help="disable all log", default=False)
parser.add_argument("--no-repo", action="store_true", required=False,
parser.add_argument("--no-repo", action="store_true", required=False,
help="disable the creation of a crash file", default=False)
args = parser.parse_args()
return args
Expand Down Expand Up @@ -1301,6 +1303,7 @@ def main():

snapshot_manager = DirSnapshotManager(
snapshot_file_path=config['snapshot_file_path'],
share_path=config['dir_path']
)

server_com = ServerCommunicator(
Expand Down
9 changes: 0 additions & 9 deletions client/example_config.json

This file was deleted.

4 changes: 3 additions & 1 deletion client/test_client_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,9 @@ def setUp(self):
self.unsinked_timestamp = 123125
self.old_timestamp = 123122

self.snapshot_manager = DirSnapshotManager(self.conf_snap_path)
self.snapshot_manager = DirSnapshotManager(
self.conf_snap_path,
self.test_share_dir)

def tearDown(self):
self.environment.remove()
Expand Down
Loading