def rebuildBinDir(user): if os.path.exists(user.getConfig()["bin-dir"]): shutil.rmtree(user.getConfig()["bin-dir"]) os.mkdir(user.getConfig()["bin-dir"]) for _, subuser in user.getRegistry().getSubusers().items(): if subuser.isExecutableShortcutInstalled(): subuser.installExecutableShortcut()
def rebuildBinDir(user): if os.path.exists(user.getConfig()["bin-dir"]): shutil.rmtree(user.getConfig()["bin-dir"]) os.mkdir(user.getConfig()["bin-dir"]) for _,subuser in user.getRegistry().getSubusers().items(): if subuser.isExecutableShortcutInstalled(): subuser.installExecutableShortcut()
def save(self): """ Save the list of subusers to disk. """ serializedUnlockedSubusersDict = {} serializedLockedSubusersDict = {} for subuserName, subuser in self.items(): serializedSubuser = {} serializedSubuser["source-repo"] = subuser.getImageSource( ).getRepository().getName() serializedSubuser["image-source"] = subuser.getImageSource( ).getName() serializedSubuser[ "executable-shortcut-installed"] = subuser.isExecutableShortcutInstalled( ) serializedSubuser["docker-image"] = subuser.getImageId() if subuser.locked(): serializedLockedSubusersDict[subuserName] = serializedSubuser else: serializedUnlockedSubusersDict[subuserName] = serializedSubuser with open( os.path.join(self.getUser().getConfig()["registry-dir"], "subusers.json"), 'w') as file_f: json.dump(serializedUnlockedSubusersDict, file_f, indent=1, separators=(',', ': ')) with open( os.path.join( self.getUser().getConfig()["locked-subusers-path"]), 'w') as file_f: json.dump(serializedLockedSubusersDict, file_f, indent=1, separators=(',', ': '))
def save(self): """ Save the list of subusers to disk. """ serializedSubusersDict = {} for subuserName, subuser in self.iteritems(): serializedSubusersDict[subuserName] = {} serializedSubusersDict[subuserName][ "source-repo"] = subuser.getImageSource().getRepository( ).getName() serializedSubusersDict[subuserName][ "image-source"] = subuser.getImageSource().getName() serializedSubusersDict[subuserName][ "executable-shortcut-installed"] = subuser.isExecutableShortcutInstalled( ) serializedSubusersDict[subuserName][ "docker-image"] = subuser.getImageId() with open( os.path.join( self.getUser().getConfig().getSubusersDotJsonPath()), 'w') as file_f: json.dump(serializedSubusersDict, file_f, indent=1, separators=(',', ': '))
def rebuildBinDir(user): if os.path.exists(user.getConfig()["bin-dir"]): shutil.rmtree(user.getConfig()["bin-dir"]) user.getEndUser().mkdir(user.getConfig()["bin-dir"]) for _,subuser in user.getRegistry().getSubusers().items(): if subuser.isExecutableShortcutInstalled(): subuser.installExecutableShortcut() if subuser.areEntryPointsExposed(): subuser.exposeEntrypoints()
def save(self): """ Save the list of subusers to disk. """ serializedSubusersDict = {} for subuserName,subuser in self.iteritems(): serializedSubusersDict[subuserName] = {} serializedSubusersDict[subuserName]["source-repo"] = subuser.getImageSource().getRepository().getName() serializedSubusersDict[subuserName]["image-source"] = subuser.getImageSource().getName() serializedSubusersDict[subuserName]["executable-shortcut-installed"] = subuser.isExecutableShortcutInstalled() serializedSubusersDict[subuserName]["docker-image"] = subuser.getImageId() with open(os.path.join(self.getUser().getConfig().getSubusersDotJsonPath()), 'w') as file_f: json.dump(serializedSubusersDict, file_f, indent=1, separators=(',', ': '))