Mysterious tuple from string bug here

Patching because I have other things to do but basically this diff at line 20 shows that even though self.secret was assigned toa  string value, it was still being given the type of tuple with the first/only item being the string value
I have no idea how this was happeneing but its fixed as of now

* also im ignoring the cargo_bin flag in the environment for now as its just causing issues while debugging
This commit is contained in:
shockrah 2021-01-20 22:50:23 -08:00
parent 84ac9883d1
commit 00fccb72e5

View File

@ -18,30 +18,16 @@ class Worker:
self.responses = {}
self.jwt = None # never gets assigned until /login is hit
if create_admin:
self.basic_creds = self.__create_admin()
# two most important details for basically everything
self.id = self.body['id']
self.secret = self.body['secret']
else:
# for now we use this because my dev server has this fake ass acc on it
self.secret = 'mH7DfAfSLHhVbo9OW4dmqTbzzLnFaZQLxoZFIlKvKHm4NfpLyZsZrYdf12aACZXyEQxELOlBTe2rc36vTPVd8A==',
self.id = 2
# This is to never be overwritten
self.basic_creds = {
'name': 'owner sama uwu',
'joindate': 69,
'status': 0,
'permissions': 18446744073709551615
}
self.basic_creds = self.__create_admin()
self.id = self.basic_creds['id']
self.secret = self.basic_creds['secret']
def __create_admin(self):
# /home/$user/.cargo/bin/cargo <- normally
# NOTE: the above path is prolly some awful shit on ci pipeline
CARGO_BIN = os.getenv('CARGO_BIN')
proc = subprocess.run(f'{CARGO_BIN} run --release -- -c dev-test'.split(), text=True, capture_output=True)
proc = subprocess.run(f'cargo run --release -- -c dev-test'.split(), text=True, capture_output=True)
try:
return json.loads(proc.stdout)
except:
@ -136,5 +122,5 @@ def run(worker: Worker):
if __name__ == '__main__':
worker = Worker('http://localhost:8888', create_admin=False)
worker = Worker('http://localhost:8888', create_admin=True)
run(worker)