owner + file_path fixed

This commit is contained in:
ahmadbilalkhalid 2019-07-01 23:55:52 +05:00
parent 3f17ee0da1
commit 7a78974053

View file

@ -54,8 +54,7 @@ for file in untracked_files:
file_id = uuid4() file_id = uuid4()
# Get Username # Get Username
owner = pathlib.Path(file).parts[2] owner = pathlib.Path(file).parts[3]
# Get Creation Date of File # Get Creation Date of File
# Here, we are assuming that ctime is creation time # Here, we are assuming that ctime is creation time
# which is mostly not true. # which is mostly not true.
@ -68,7 +67,7 @@ for file in untracked_files:
sha_sum = sha512sum(file) sha_sum = sha512sum(file)
# File Path excluding base and username # File Path excluding base and username
file_path = pathlib.Path(file).parts[3:] file_path = pathlib.Path(file).parts[4:]
file_path = os.path.join(*file_path) file_path = os.path.join(*file_path)
# Create Entry # Create Entry
@ -81,7 +80,6 @@ for file in untracked_files:
} }
print(f"Tracking {file}") print(f"Tracking {file}")
# Insert Entry # Insert Entry
etcd_client.put(entry_key, entry_value, value_in_json=True) etcd_client.put(entry_key, entry_value, value_in_json=True)
xattr.setxattr(file, b"user.utracked", b"True") xattr.setxattr(file, b"user.utracked", b"True")