owner + file_path fixed
This commit is contained in:
parent
3f17ee0da1
commit
7a78974053
1 changed files with 2 additions and 4 deletions
6
main.py
6
main.py
|
@ -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")
|
||||||
|
|
Loading…
Reference in a new issue