Ejemplo n.º 1
0
  Running garbage collector on temporary repositories...
  """
    options, args = parseCliArgs(sysargs)
    action = args[0]
    if action == "add":
        if not len(args) == 3:
            sys.exit(
                "Wrong number of arguments to add.  See `subuser subuser -h`.")
        name = args[1]
        imageSourceId = args[2]
        subuserlib.subuser.add(user, name, imageSourceId)
    elif action == "remove":
        name = args[1]
        subuserlib.subuser.remove(user, name)
    elif action == "create-shortcut":
        name = args[1]
        subuserlib.subuser.setExecutableShortcutInstalled(user, name, True)
    elif action == "remove-shortcut":
        name = args[1]
        subuserlib.subuser.setExecutableShortcutInstalled(user, name, False)
    else:
        sys.exit("Action " + args[0] +
                 " does not exist. Try:\n subuser subuser --help")


#################################################################################################

if __name__ == "__main__":
    user = subuserlib.classes.user.User()
    subuser(user, sys.argv)
Ejemplo n.º 2
0
  elif action == "remove":
    names = args[1:]
    if not options.prefix is None:
      allSubuserNames = user.getRegistry().getSubusers().keys()
      names.extend([subuserName for subuserName in allSubuserNames if subuserName.startswith(options.prefix)])
    with user.getRegistry().getLock():
      subuserlib.subuser.remove(user,names)
  elif action == "create-shortcut":
    name = args[1]
    with user.getRegistry().getLock():
      subuserlib.subuser.setExecutableShortcutInstalled(user,name,True)
  elif action == "remove-shortcut":
    name = args[1]
    with user.getRegistry().getLock():
      subuserlib.subuser.setExecutableShortcutInstalled(user,name,False)
  elif action == "edit-permissions":
    name = args[1]
    with user.getRegistry().getLock():
      user.getRegistry().logChange("Edit "+name+"'s permissions.")
      subuser = user.getRegistry().getSubusers()[name]
      subuser.editPermissionsCLI()
      subuserlib.verify.verify(user,subuserNames=[name],permissionsAccepter=permissionsAccepter,prompt=options.prompt)
      user.getRegistry().commit()
  else:
    sys.exit("Action "+args[0]+" does not exist. Try:\n subuser subuser --help")

#################################################################################################

if __name__ == "__main__":
  subuser(sys.argv[1:])
Ejemplo n.º 3
0
  [u'foo']
  """
  options,args = parseCliArgs(sysargs)
  action = args[0]
  if action == "add":
    if not len(args) == 3:
      sys.exit("Wrong number of arguments to add.  See `subuser subuser -h`.")
    name = args[1]
    imageSourceId = args[2]
    subuserlib.subuser.add(user,name,imageSourceId)
  elif action == "remove":
    name = args[1]
    subuserlib.subuser.remove(user,name)
  elif action == "create-shortcut":
    name = args[1]
    subuserlib.subuser.setExecutableShortcutInstalled(user,name,True)
  elif action == "remove-shortcut":
    name = args[1]
    subuserlib.subuser.setExecutableShortcutInstalled(user,name,False)
  else:
    sys.exit("Action "+args[0]+" does not exist. Try:\n subuser subuser --help")
#################################################################################################




  
if __name__ == "__main__":
  user = subuserlib.classes.user.User()
  subuser(user,sys.argv)