Ejemplo n.º 1
0
      commit = args[2]
    except IndexError:
      sys.exit("Wrong number of arguments.  Expected a subuser name and a commit.  Try running\nsubuser update --help\n for more info.")
    with user.getRegistry().getLock():
      try:
        subuser = user.getRegistry().getSubusers()[subuserName]
      except KeyError:
        sys.exit("Subuser "+subuserName+" does not exist and therefore cannot be locked. Use --help for help.")
      subuserlib.update.lockSubuser(user,subuser=subuser,commit=commit)
  elif "unlock-subuser" == args[0]:
    try:
      subuserName = args[1]
    except IndexError:
      sys.exit("Wrong number of arguments.  Expected a subuser's name. Try running\nsubuser update --help\nfor more information.")
    try:
      subuser = user.getRegistry().getSubusers()[subuserName]
    except KeyError:
      sys.exit("Subuser "+subuserName+" does not exist. Cannot lock. Use --help for help.")
    with user.getRegistry().getLock():
      subuserlib.update.unlockSubuser(user,subuser=subuser,permissionsAccepter=permissionsAccepter,prompt=options.prompt)
  elif len(args) == 1:
    sys.exit(" ".join(args) + " is not a valid update subcommand. Please use subuser update -h for help.")
  else:
    sys.exit(" ".join(args) + " is not a valid update subcommand. Please use subuser update -h for help.")

if __name__ == "__main__":
  try:
    update(sys.argv[1:])
  except KeyboardInterrupt:
    pass
Ejemplo n.º 2
0
  Checking if images need to be updated or installed...
  Installing dependency2 ...
  Installing intermediary ...
  Installing dependent ...
  Installed new image for subuser dependent
  Running garbage collector on temporary repositories...
  >>> set(user.getRegistry().getSubusers().keys()) == set(['dependent', u'foo'])
  True
  >>> set([i.getImageSourceName() for i in user.getInstalledImages().values()]) == set([u'foo', u'dependency1', u'bar', u'dependent', u'intermediary', u'intermediary', u'dependency2', u'dependent'])
  True

  Old images are not deleted so that update lock-subuser-to and update rollback still work. In this example, dependency1 stays installed.
  """
  options,args = parseCliArgs(sysargs)
  if len(args) < 1:
    sys.exit("No arguments given. Please use subuser update -h for help.")
  elif ["all"] == args:
    subuserlib.update.updateAll(user)
  elif ["log"] == args:
    subuserlib.update.showLog(user)
  elif len(args) == 1:
    sys.exit(" ".join(args) + " is not a valid update subcommand. Please use subuser update -h for help.")
  elif "rollback" == args[0]:
    subuserlib.update.rollback(user,commit=args[1])
  else:
    sys.exit(" ".join(args) + " is not a valid update subcommand. Please use subuser update -h for help.")

if __name__ == "__main__":
  user = subuserlib.classes.user.User()
  update(user,sys.argv)
Ejemplo n.º 3
0
    with user.getRegistry().getLock():
      subuserlib.update.all(user,permissionsAccepter=permissionsAccepter)
  elif "subusers" == args[0]:
    with user.getRegistry().getLock():
      subuserlib.update.subusers(user,args[1:],permissionsAccepter=permissionsAccepter)
  elif "lock-subuser-to" == args[0]:
    try:
      subuserName = args[1]
      commit = args[2]
    except KeyError:
      sys.exit("Wrong number of arguments.  Expected a subuser name and a commit.  Try running\nsubuser update --help\n for more info.")
    with user.getRegistry().getLock():
      subuserlib.update.lockSubuser(user,subuserName=subuserName,commit=commit)
  elif "unlock-subuser" == args[0]:
    try:
      subuserName = args[1]
    except KeyError:
      sys.exit("Wrong number of arguments.  Expected a subuser's name. Try running\nsubuser update --help\nfor more information.")
    with user.getRegistry().getLock():
      subuserlib.update.unlockSubuser(user,subuserName=subuserName,permissionsAccepter=permissionsAccepter)
  elif len(args) == 1:
    sys.exit(" ".join(args) + " is not a valid update subcommand. Please use subuser update -h for help.")
  else:
    sys.exit(" ".join(args) + " is not a valid update subcommand. Please use subuser update -h for help.")

if __name__ == "__main__":
  try:
    update(sys.argv[1:])
  except KeyboardInterrupt:
    pass
Ejemplo n.º 4
0
  Checking if images need to be updated or installed...
  Installing dependency2 ...
  Installing intermediary ...
  Installing dependent ...
  Installed new image for subuser dependent
  Running garbage collector on temporary repositories...
  >>> user.getRegistry().getSubusers().keys()
  ['dependent', u'foo']
  >>> [i.getImageSourceName() for i in user.getInstalledImages().values()]
  [u'foo', u'dependency1', u'bar', u'dependent', u'intermediary', u'intermediary', u'dependency2', u'dependent']

  Note that dependency1 stays installed, so we can always use subuser update checkout to go back to the version before the update.
  """
  options,args = parseCliArgs(sysargs)
  if len(args) < 1:
    sys.exit("No arguments given. Please use subuser update -h for help.")
  elif ["all"] == args:
    subuserlib.update.updateAll(user)
  elif ["log"] == args:
    subuserlib.update.showLog(user)
  elif len(args) == 1:
    sys.exit(" ".join(args) + " is not a valid update subcommand. Please use subuser update -h for help.")
  elif "rollback" == args[0]:
    subuserlib.update.rollback(user,commit=args[1])
  else:
    sys.exit(" ".join(args) + " is not a valid update subcommand. Please use subuser update -h for help.")

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