• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python user.getRegistry函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中subuserlib.classes.user.getRegistry函数的典型用法代码示例。如果您正苦于以下问题:Python getRegistry函数的具体用法?Python getRegistry怎么用?Python getRegistry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getRegistry函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: verify

def verify(realArgs):
  options,arguments=parseCliArgs(realArgs)
  user = subuserlib.classes.user.User()
  try:
    with user.getRegistry().getLock() as LockFileHandle:
      subuserlib.verify.verify(user)
      user.getRegistry().commit()
  except subuserlib.portalocker.portalocker.LockException:
    sys.exit("Another subuser process is currently running and has a lock on the registry. Please try again later.")
开发者ID:ypid,项目名称:subuser,代码行数:9,代码来源:repair.py


示例2: describe

def describe(sysargs):
  """
  Describe subusers and images.
  
  >>> import describe #import self

  Describing a subuser prints its permissions.

  >>> describe.describe(["subuser","foo"])
  Subuser: foo
  ------------------
  Progam:
  foo:
   Description: 
   Maintainer: 
   Last update time(version): 0
   Executable: /usr/bin/foo

  Describing an image prints the default permissions for that image.

  >>> describe.describe(["image","foo"])
  foo:
   Description: 
   Maintainer: 
   Last update time(version): 0
   Executable: /usr/bin/foo

  Images can be refered to with their full paths as well.  Even remote images can be described.

  >>> describe.describe(["image","[email protected]"])
  foo:
   Description: 
   Maintainer: 
   Last update time(version): 0
   Executable: /usr/bin/foo
  """
  user = subuserlib.classes.user.User()
  (options,args) = parseCliArgs(sysargs)
  if len(args) < 2:
    print("Args: '"+"' '".join(args)+"'")
    print("Wrong number of arguments.")
    #parseCliArgs(["","subuser","describe","--help"])
  elif args[0] == "image":
    for image in args[1:]:
      subuserlib.resolve.resolveImageSource(user,image).describe()
  elif args[0] == "subuser":
    for subuser in  args[1:]:
      try:
        user.getRegistry().getSubusers()[subuser].describe()
      except KeyError:
        sys.exit("Subuser "+subuser+" does not exist.")
  else:
    print("Args: '"+"' '".join(args)+"'")
    print("Option not supported.")
开发者ID:xsongx,项目名称:subuser,代码行数:54,代码来源:describe.py


示例3: add

def add(user,name,url):
    repository = subuserlib.resolve.lookupRepositoryByURI(user,url)
    if repository:
      if type(repository.getName()) is int:
        sys.exit("A temporary repository with this url already exists.  Cannot add.  The ability to uprade temporary repositories to named repositories is a wanted feature.  Feal free to send a quality, well thought out, pull request.")
      else:
        sys.exit("The repository named:" +repository.getName()+" already has this URL.  Cannot add.")
    else:
      repository = subuserlib.classes.repository.Repository(user,name=name,gitOriginURI=url,gitCommitHash="master")
      user.getRegistry().getRepositories().addRepository(repository)
      user.getRegistry().commit()
开发者ID:marclaporte,项目名称:subuser,代码行数:11,代码来源:repository.py


示例4: run

def run(args):
    if len(args) == 1 or {"help", "-h", "--help"} & set(args):
        sys.exit(helpString)

    subuserName = args[1]
    argsToPassToImage = args[2:]

    user = subuserlib.classes.user.User()
    if subuserName in user.getRegistry().getSubusers():
        subuserlib.run.run(user.getRegistry().getSubusers()[subuserName], argsToPassToImage)
    else:
        sys.exit(subuserName + " not found.\n" + helpString)
开发者ID:marclaporte,项目名称:subuser,代码行数:12,代码来源:run.py


示例5: removeOldImages

def removeOldImages(user):
  """
  Remove images that are installed, but are not associated with any subusers.

 >>> remove_old_images = __import__("remove-old-images")#import self
 >>> import subuserlib.classes.user,subuserlib.subuser
 >>> user = subuserlib.classes.user.User()
 >>> user.getRegistry().getSubusers().keys()
 [u'foo']
 >>> subuserlib.subuser.add(user,"bar","[email protected]:///home/travis/remote-test-repo")
 Adding new temporary repository file:///home/travis/remote-test-repo
 Adding subuser bar [email protected]:///home/travis/remote-test-repo
 Verifying subuser configuration.
 Verifying registry consistency...
 Unregistering any non-existant installed images.
 Checking if images need to be updated or installed...
 Installing bar ...
 Installed new image for subuser bar
 Running garbage collector on temporary repositories...
 >>> user.getRegistry().getSubusers().keys()
 [u'foo', 'bar']
 >>> [i.getImageSourceName() for i in user.getInstalledImages().values()]
 [u'foo', u'bar']
 >>> subuserlib.subuser.remove(user,"bar")
 Removing subuser bar
  If you wish to remove the subusers image, issue the command $ subuser remove-old-images
 Verifying subuser configuration.
 Verifying registry consistency...
 Unregistering any non-existant installed images.
 Checking if images need to be updated or installed...
 Running garbage collector on temporary repositories...
 >>> [i.getImageSourceName() for i in user.getInstalledImages().values()]
 [u'foo', u'bar']
 >>> remove_old_images.removeOldImages(user)
 Verifying subuser configuration.
 Verifying registry consistency...
 Unregistering any non-existant installed images.
 Checking if images need to be updated or installed...
 Running garbage collector on temporary repositories...
 Removing uneeded temporary repository: file:///home/travis/remote-test-repo
 >>> [i.getImageSourceName() for i in user.getInstalledImages().values()]
 [u'foo']
  """
  for installedImageId,installedImage in user.getInstalledImages().iteritems():
    imageInUse = False
    for _,subuser in user.getRegistry().getSubusers().iteritems():
      if subuser.getImageId() == installedImageId:
        imageInUse = True
    if not imageInUse:
      installedImage.removeDockerImage()
  subuserlib.verify.verify(user)
  user.getRegistry().commit()
开发者ID:takluyver,项目名称:subuser,代码行数:52,代码来源:remove-old-images.py


示例6: run

def run(args):
  if len(args) == 1 or args[1] == "--help":
    print(helpString)
    sys.exit()

  subuserName = args[1]
  argsToPassToImage = args[2:]

  user = subuserlib.classes.user.User()
  if subuserName in user.getRegistry().getSubusers():
    user.getRegistry().getSubusers()[subuserName].getRuntime(os.environ).run(argsToPassToImage)
  else:
    sys.exit(subuserName + " not found.\n"+helpString)
开发者ID:akovalyov,项目名称:subuser,代码行数:13,代码来源:run.py


示例7: list

def list(sysargs):
  """
  List various things: image sources, subusers, ect.

  >>> import sys
  >>> import list #import self
  >>> list.list([sys.argv[0]]+["list","available"])
  Images available for instalation from the repo: default
  foo:
   Description: 
   Maintainer: 
   Last update time(version): 0
   Executable: /usr/bin/foo
  >>> list.list([sys.argv[0]]+["list","subusers"])
  The following subusers are registered.
  Subuser: foo
  ------------------
  Progam:
  foo:
   Description: 
   Maintainer: 
   Last update time(version): 0
   Executable: /usr/bin/foo
  >>> list.list([sys.argv[0]]+["list","subusers","--short"])
  foo
  """
  options,args = parseCliArgs(sysargs)
 
  if len(args)==0:
    sys.exit("Nothing to list. Issue this command with the -h argument for help.")
  
  user = subuserlib.classes.user.User()
  
  if 'available' in args:
    for repoName,repository in user.getRegistry().getRepositories().iteritems():
      if not options.short:
        print("Images available for instalation from the repo: " + repoName)
      for imageName,imageSource in repository.iteritems():
        if options.short:
          print(imageName)
        else:
          imageSource.describe()
  
  if 'subusers' in args:
    if not options.short:
      print("The following subusers are registered.")
    for name,subuser in user.getRegistry().getSubusers().iteritems():
      if options.short:
        print(name)
      else:
        subuser.describe()
开发者ID:takluyver,项目名称:subuser,代码行数:51,代码来源:list.py


示例8: add

def add(user,subuserName,imageSourceIdentifier):
  try:
    try:
      imageSource = subuserlib.resolve.resolveImageSource(user,imageSourceIdentifier)
    except KeyError as keyError:
      sys.exit("Could not add subuser.  The image source "+imageSourceIdentifier+" does not exist.")
    user.getRegistry().logChange("Adding subuser "+subuserName+" "+imageSourceIdentifier)
    user.getRegistry().getSubusers()[subuserName] = subuserlib.classes.subuser.Subuser(user,subuserName,imageSource,None,False)
    subuserlib.verify.verify(user)
    user.getRegistry().commit()
  except subuserlib.classes.dockerDaemon.ImageBuildException as e:
    print("Adding subuser failed.")
    print(str(e))
    subuserlib.update.checkoutNoCommit(user,"HEAD")
开发者ID:takluyver,项目名称:subuser,代码行数:14,代码来源:subuser.py


示例9: setExecutableShortcutInstalled

def setExecutableShortcutInstalled(user,subuserName,installed):
  if installed:
    user.getRegistry().logChange("Creating shortcut for subuser "+subuserName)
  else:
    user.getRegistry().logChange("Removing shortcut for subuser "+subuserName)
  user.getRegistry().getSubusers()[subuserName].setExecutableShortcutInstalled(installed)
  subuserlib.verify.verify(user)
  user.getRegistry().commit()
开发者ID:takluyver,项目名称:subuser,代码行数:8,代码来源:subuser.py


示例10: run

def run(args):
    if len(args) == 1 or args[1] == "-h" or args[1] == "--help":
        print(helpString)
        sys.exit()

    subuserName = args[1]
    argsToPassToImage = args[2:]

    user = subuserlib.classes.user.User()
    user.getRegistry().setLogOutputVerbosity(0)
    if subuserName in user.getRegistry().getSubusers():
        runtime = user.getRegistry().getSubusers()[subuserName].getRuntime(os.environ)
        if runtime:
            runtime.run(argsToPassToImage)
        else:
            sys.exit(
                "The subuser's image failed to build. Please use the subuser update log and subuser repair commands for more information."
            )
    else:
        sys.exit(subuserName + " not found.\n" + helpString)
开发者ID:peter1000,项目名称:subuser,代码行数:20,代码来源:run.py


示例11: dryRun

def dryRun(args):
  """
  Print the command that would have been run if this wasn't a dry run.

  >>> dry_run = __import__("dry-run")
  >>> dry_run.dryRunTestSetup()
  >>> dry_run.dryRun([sys.argv[0]]+["foo"])
  docker 'run' '-i' '-t' '--rm' '--workdir=/home/travis/test-home' '-v=/home/travis/test-home/.subuser/homes/foo:/home/travis/test-home:rw' '-e' 'HOME=/home/travis/test-home' '--net=none' '--user=1000' '1' '/usr/bin/foo'
  """
  if len(args) == 1 or {"help","-h","--help"} & set(args):
    sys.exit(helpString)

  subuserName = args[1]
  argsToPassToImage = args[2:]

  user = subuserlib.classes.user.User()
  if subuserName in user.getRegistry().getSubusers():
    print(subuserlib.run.getPrettyCommand(user.getRegistry().getSubusers()[subuserName],argsToPassToImage))
  else:
    sys.exit(subuserName + " not found.\n"+helpString)
开发者ID:marclaporte,项目名称:subuser,代码行数:20,代码来源:dry-run.py


示例12: runCommand

def runCommand(sysargs):
  """
  Describe subusers and images.
  """
  user = subuserlib.classes.user.User()
  (options,args) = parseCliArgs(sysargs)
  if len(args) < 2:
    subuserlib.print.printWithoutCrashing("Nothing to describe. Use -h for help.")
  elif args[0] == "image":
    for image in args[1:]:
      subuserlib.resolve.resolveImageSource(user,image).describe()
  elif args[0] == "subuser":
    for subuser in  args[1:]:
      try:
        user.getRegistry().getSubusers()[subuser].describe()
      except KeyError:
        sys.exit("Subuser "+subuser+" does not exist.")
  else:
    subuserlib.print.printWithoutCrashing("Args: '"+"' '".join(args)+"'")
    subuserlib.print.printWithoutCrashing("Option not supported.")
开发者ID:awesome-docker,项目名称:subuser,代码行数:20,代码来源:describe.py


示例13: testImages

def testImages(realArgs):
  """
  Test the given images.
  """
  options,args = parseCliArgs(realArgs)

  user = subuserlib.classes.user.User()

  try:
    with user.getRegistry().getLock() as lockFileHandler:
      subuserlib.testImages.testImages(user=user,sourceRepoId=args[0],imageSourceNames=args[1:])
  except subuserlib.portalocker.portalocker.LockException:
    sys.exit("Another subuser process is currently running and has a lock on the registry. Please try again later.")
开发者ID:xsongx,项目名称:subuser,代码行数:13,代码来源:test-images.py


示例14: remove

def remove(user,subuserName):
  if subuserName in user.getRegistry().getSubusers():
    user.getRegistry().logChange("Removing subuser "+subuserName)
    del user.getRegistry().getSubusers()[subuserName]
    subuserlib.verify.verify(user)
    user.getRegistry().commit()
  else:
    sys.exit("Cannot remove: subuser "+subuserName+" does not exist.")
开发者ID:marclaporte,项目名称:subuser,代码行数:8,代码来源:subuser.py


示例15: dryRun

def dryRun(args):
    if len(args) == 0 or {"help", "-h", "--help"} & set(args):
        print(helpString)
        sys.exit()
    subuserName = args[0]
    argsToPassToImage = args[1:]
    user = subuserlib.classes.user.User()
    if subuserName in user.getRegistry().getSubusers():
        subuser = user.getRegistry().getSubusers()[subuserName]
        print("The image will be prepared using the Dockerfile:")
        print(subuser.getRunReadyImage().generateImagePreparationDockerfile())
        print("The command to launch the image is:")
        print(subuser.getRuntime(os.environ).getPrettyCommand(argsToPassToImage))
    else:
        availableSubusers = ",".join(user.getRegistry().getSubusers().keys())
        sys.exit(
            subuserName
            + " not found.\n"
            + helpString
            + "\n"
            + "The following subusers are available for use:"
            + availableSubusers
        )
开发者ID:talwrii,项目名称:subuser,代码行数:23,代码来源:subuser-dry-run.py


示例16: list

def list(sysargs):
  """
  List various things: image sources, subusers, ect.

  >>> import sys
  >>> list = __import__("subuser-list") #import self

  Listing available images lists the images along with their default permissions.

  >>> list.list(["available"])
  Images available for instalation from the repo: default
  [email protected]
   Description: 
   Maintainer: 
   Executable: /usr/bin/foo

  Similar result when listing subusers.

  >>> list.list(["subusers"])
  The following subusers are registered.
  Subuser: foo
  ------------------
  [email protected]
   Description: 
   Maintainer: 
   Executable: /usr/bin/foo
  <BLANKLINE>

  And listing installed images:

  >>> list.list(["installed-images"])
  The following images are installed.
  ------------------
  Image Id: 2
  Image source: [email protected]
  Last update time: 1

  > list.list(["repositories"])
  Repository: default
  ------------
  Cloned from: file:///home/travis/default-test-repo
  Currently at commit: 72e7d9c17192d47b2b2344d9eb8a325262d738fe

  In all cases, there is a ``--short`` option.

  >>> list.list(["subusers","--short"])
  foo

  >>> list.list(["available","--short"])
  [email protected]

  You can specify which repository to list image sources from.

  >>> list.list(["available","default","--short"])
  [email protected]

  When listing available image sources, refering to a repository via a URI works as well.

  >>> list.list(["available","file:///home/travis/version-constrained-test-repo","--short"])
  Adding new temporary repository file:///home/travis/version-constrained-test-repo
  [email protected]:///home/travis/version-constrained-test-repo

  >>> list.list(["installed-images","--short"])
  [email protected] 2

  >>> list.list(["repositories","--short"])
  default

  """
  options,args = parseCliArgs(sysargs)
  if len(args)==0:
    sys.exit("Nothing to list. Issue this command with the -h argument for help.")
  user = subuserlib.classes.user.User()
  if args[0] == 'available':
    if len(args) > 1:
      reposToList = args[1:]
    else:
      reposToList = user.getRegistry().getRepositories().keys()
    if options.json:
      availableDict = {}
      for repoIdentifier in reposToList:
        if repoIdentifier in user.getRegistry().getRepositories():
          temp = False
        else:
          temp = True
        repository = subuserlib.resolve.resolveRepository(user,repoIdentifier)
        availableDict[repository.getName()] = repository.serializeToDict()
        if temp:
          repository.removeGitRepo()
      print(json.dumps(availableDict,indent=1,separators=(",",": ")))
      sys.exit()
    for repoIdentifier in reposToList:
      if repoIdentifier in user.getRegistry().getRepositories():
        temp = False
      else:
        temp = True
      repository =  subuserlib.resolve.resolveRepository(user,repoIdentifier)
      if not options.short:
        print("Images available for instalation from the repo: " + repository.getName())
      for _,imageSource in repository.items():
#.........这里部分代码省略.........
开发者ID:ruipgpinheiro,项目名称:subuser,代码行数:101,代码来源:subuser-list.py


示例17: removeOldImages

def removeOldImages(realArgs):
  """
  Remove images that are installed, but are not associated with any subusers.

  Tests
  -----

  **Setup:**

  >>> remove_old_images = __import__("remove-old-images")#import self
  >>> import subuser
  >>> import subuserlib.classes.user

  Check our assumptions about what subusers are installed in the test environment.  We load a new user object each time we checked, because we are interested about whether the changes we want are present on disk.

  >>> user = subuserlib.classes.user.User()
  >>> set(user.getRegistry().getSubusers().keys()) == set(["foo"])
  True

  Add a ``bar`` subuser, which we will then remove.  This will leave us with a leftover image.

  >>> subuser.subuser(["add","bar","[email protected]:///home/travis/remote-test-repo"])
  Adding subuser bar [email protected]:///home/travis/remote-test-repo
  Adding new temporary repository file:///home/travis/remote-test-repo
  Verifying subuser configuration.
  Verifying registry consistency...
  Unregistering any non-existant installed images.
  Checking if images need to be updated or installed...
  Installing bar ...
  Building...
  Building...
  Building...
  Successfully built 5
  Building...
  Building...
  Building...
  Successfully built 6
  Installed new image for subuser bar
  Running garbage collector on temporary repositories...

  Check to see if subuser ``bar`` was successfully added.

  >>> user = subuserlib.classes.user.User()
  >>> set(user.getRegistry().getSubusers().keys()) == set([u'foo', 'bar'])
  True

  Check to see if the image for ``bar`` was also installed.

  >>> set([i.getImageSourceName() for i in user.getInstalledImages().values()]) == set([u'foo', u'bar'])
  True

  Remove the ``bar`` subuser.

  >>> subuser.subuser(["remove","bar"])
  Removing subuser bar
   If you wish to remove the subusers image, issue the command $ subuser remove-old-images
  Verifying subuser configuration.
  Verifying registry consistency...
  Unregistering any non-existant installed images.
  Checking if images need to be updated or installed...
  Running garbage collector on temporary repositories...

  See that the image for ``bar`` was indeed left behind.

  >>> user = subuserlib.classes.user.User()
  >>> set([i.getImageSourceName() for i in user.getInstalledImages().values()]) == set([u'foo', u'bar'])
  True

  Use dry-run to see which images are to be deleted.

  >>> remove_old_images.removeOldImages(["--dry-run"])
  The following images are uneeded and would be deleted.
  DOCKER-ID : SUBUSER-ID
  Removing unneeded image 6 : [email protected]:///home/travis/remote-test-repo

  Now we use ``remove-old-images`` to clean up our installed images.

  >>> remove_old_images.removeOldImages([])
  Removing unneeded image 6 : [email protected]:///home/travis/remote-test-repo
  Verifying subuser configuration.
  Verifying registry consistency...
  Unregistering any non-existant installed images.
  Checking if images need to be updated or installed...
  Running garbage collector on temporary repositories...
  Removing uneeded temporary repository: file:///home/travis/remote-test-repo

  And now the uneccesary ``bar`` image is gone.

  >>> user = subuserlib.classes.user.User()
  >>> set([i.getImageSourceName() for i in user.getInstalledImages().values()]) == set([u'foo'])
  True
 
  """
  options,args = parseCliArgs(realArgs)

  user = subuserlib.classes.user.User()

  try:
    with user.getRegistry().getLock() as lockFileHandler:
      if options.dryrun:
#.........这里部分代码省略.........
开发者ID:ypid,项目名称:subuser,代码行数:101,代码来源:remove-old-images.py


示例18: subuser

def subuser(sysargs):
  """
  Manage subusers

  Tests
  -----

  **Setup:**

  >>> import subuser #import self
  >>> import subuserlib.classes.user

  At the start of our tests, the test environment has one subuser named ``foo``.

  >>> user = subuserlib.classes.user.User()
  >>> set(user.getRegistry().getSubusers().keys()) == set([u'foo'])
  True

  We add another subuser named ``bar``.

  >>> subuser.subuser(["add","bar","[email protected]:///home/travis/remote-test-repo"])
  Adding subuser bar [email protected]:///home/travis/remote-test-repo
  Adding new temporary repository file:///home/travis/remote-test-repo
  Verifying subuser configuration.
  Verifying registry consistency...
  Unregistering any non-existant installed images.
  Checking if images need to be updated or installed...
  Installing bar ...
  Building...
  Building...
  Building...
  Successfully built 6
  Building...
  Building...
  Building...
  Successfully built 7
  Installed new image for subuser bar
  Running garbage collector on temporary repositories...

  Now we have two subusers.

  >>> user = subuserlib.classes.user.User()
  >>> set(user.getRegistry().getSubusers().keys()) == set([u'foo', 'bar'])
  True

  We remove ``bar``.

  >>> subuser.subuser(["remove","bar"])
  Removing subuser bar
   If you wish to remove the subusers image, issue the command $ subuser remove-old-images
  Verifying subuser configuration.
  Verifying registry consistency...
  Unregistering any non-existant installed images.
  Checking if images need to be updated or installed...
  Running garbage collector on temporary repositories...

  Now we only have one subuser.

  >>> user = subuserlib.classes.user.User()
  >>> set(user.getRegistry().getSubusers().keys()) == set([u'foo'])
  True

  We add another subuser named ``bar`` using a local folder rather than from a git repo.

  >>> subuser.subuser(["add","bar","[email protected]/home/travis/remote-test-repo"])
  Adding subuser bar [email protected]/home/travis/remote-test-repo
  Adding new temporary repository /home/travis/remote-test-repo
  Verifying subuser configuration.
  Verifying registry consistency...
  Unregistering any non-existant installed images.
  Checking if images need to be updated or installed...
  Installing bar ...
  Building...
  Building...
  Building...
  Successfully built 8
  Building...
  Building...
  Building...
  Successfully built 9
  Installed new image for subuser bar
  Running garbage collector on temporary repositories...

  Now we have two subusers.

  >>> user = subuserlib.classes.user.User()
  >>> set(user.getRegistry().getSubusers().keys()) == set([u'foo', 'bar'])
  True

  We remove ``bar``.

  >>> subuser.subuser(["remove","bar"])
  Removing subuser bar
   If you wish to remove the subusers image, issue the command $ subuser remove-old-images
  Verifying subuser configuration.
  Verifying registry consistency...
  Unregistering any non-existant installed images.
  Checking if images need to be updated or installed...
  Running garbage collector on temporary repositories...

#.........这里部分代码省略.........
开发者ID:ypid,项目名称:subuser,代码行数:101,代码来源:subuser.py


示例19: update

def update(realArgs):
  """
  Update your subuser installation.

  Tests
  -----

  **Setup:**

  >>> import os
  >>> import update,subuser,subuserlib.classes.gitRepository,repository

  Check initial test environment:

  >>> user = subuserlib.classes.user.User()
  >>> set(user.getRegistry().getSubusers().keys()) == set([u'foo'])
  True
  >>> set([i.getImageSourceName() for i in user.getInstalledImages().values()]) == set([u'foo', u'bar'])
  True

  Add a subuser who's image has a lot of dependencies.

  >>> subuser.subuser(["add","dependent","[email protected]:///home/travis/remote-test-repo"])
  Adding subuser dependent [email protected]:///home/travis/remote-test-repo
  Verifying subuser configuration.
  Verifying registry consistency...
  Unregistering any non-existant installed images.
  Checking if images need to be updated or installed...
  Checking if subuser dependent is up to date.
  Installing dependency1 ...
  Building...
  Building...
  Building...
  Successfully built 10
  Building...
  Building...
  Building...
  Successfully built 11
  Installing intermediary ...
  Building...
  Building...
  Building...
  Successfully built 12
  Building...
  Building...
  Building...
  Successfully built 13
  Installing dependent ...
  Building...
  Building...
  Building...
  Successfully built 14
  Building...
  Building...
  Building...
  Successfully built 15
  Installed new image <15> for subuser dependent
  Running garbage collector on temporary repositories...

  Check that our new subuser was successfully added.

  >>> user = subuserlib.classes.user.User()
  >>> subuserNamesBeforeUpdate = user.getRegistry().getSubusers().keys()
  >>> set(subuserNamesBeforeUpdate) == set(['dependent', u'foo'])
  True

  And that its image, along with all of its dependencies were added as well.

  >>> installedImagesBeforeUpdate = [i.getImageSourceName() for i in user.getInstalledImages().values()]
  >>> set(installedImagesBeforeUpdate) == set([u'foo', u'dependency1', u'bar', u'dependent', u'intermediary'])
  True

  Running update, when there is nothing to be updated, does nothing.

  >>> update.update(["all"])
  Updating...
  Verifying subuser configuration.
  Verifying registry consistency...
  Unregistering any non-existant installed images.
  Checking if images need to be updated or installed...
  Checking if subuser dependent is up to date.
  Checking for updates to: [email protected]:///home/travis/remote-test-repo
  Checking for updates to: [email protected]:///home/travis/remote-test-repo
  Checking for updates to: [email protected]:///home/travis/remote-test-repo
  Checking if subuser foo is up to date.
  Checking for updates to: [email protected]
  Running garbage collector on temporary repositories...

  The same subusers are still installed.

  >>> user = subuserlib.classes.user.User()
  >>> set(user.getRegistry().getSubusers().keys()) == set(subuserNamesBeforeUpdate)
  True

  And the same images too.

  >>> set([i.getImageSourceName() for i in user.getInstalledImages().values()]) == set(installedImagesBeforeUpdate)
  True

  Now we change the ImageSource for the ``dependent`` image.
#.........这里部分代码省略.........
开发者ID:xsongx,项目名称:subuser,代码行数:101,代码来源:update.py


示例20: subuser

def subuser(sysargs):
  """
  Manage subusers

  Tests
  -----

  **Setup:**

  >>> import subuser #import self
  >>> import subuserlib.classes.user

  At the start of our tests, the test environment has one subuser named ``foo``.

  >>> user = subuserlib.classes.user.User()
  >>> set(user.getRegistry().getSubusers().keys()) == set([u'foo'])
  True

  We add another subuser named ``bar``.

  >>> subuser.subuser(["add","--accept","bar","[email protected]:///home/travis/remote-test-repo"])
  Adding subuser bar [email protected]:///home/travis/remote-test-repo
  Adding new temporary repository file:///home/travis/remote-test-repo
  Verifying subuser configuration.
  Verifying registry consistency...
  Unregistering any non-existant installed images.
  bar would like to have the following permissions:
   Description: 
   Maintainer: 
   Executable: /usr/bin/bar
  A - Accept and apply changes
  E - Apply changes and edit result
  A
  Checking if images need to be updated or installed...
  Checking if subuser bar is up to date.
  Installing bar ...
  Building...
  Building...
  Building...
  Successfully built 6
  Building...
  Building...
  Building...
  Successfully built 8
  Installed new image <8> for subuser bar
  Running garbage collector on temporary repositories...

  Now we have two subusers.

  >>> user = subuserlib.classes.user.User()
  >>> set(user.getRegistry().getSubusers().keys()) == set([u'foo', 'bar'])
  True

  We remove ``bar``.

  >>> subuser.subuser(["remove","bar"])
  Removing subuser bar
   If you wish to remove the subusers image, issue the command $ subuser remove-old-images
  Verifying subuser configuration.
  Verifying registry consistency...
  Unregistering any non-existant installed images.
  Running garbage collector on temporary repositories...

  Now we only have one subuser.

  >>> user = subuserlib.classes.user.User()
  >>> set(user.getRegistry().getSubusers().keys()) == set([u'foo'])
  True

  We add another subuser named ``bar`` using a local folder rather than from a git repo.

  >>> subuser.subuser(["add","--accept","bar","[email protected]/home/travis/remote-test-repo"])
  Adding subuser bar [email protected]/home/travis/remote-test-repo
  Adding new temporary repository /home/travis/remote-test-repo
  Verifying subuser configuration.
  Verifying registry consistency...
  Unregistering any non-existant installed images.
  bar would like to have the following permissions:
   Description: 
   Maintainer: 
   Executable: /usr/bin/bar
  A - Accept and apply changes
  E - Apply changes and edit result
  A
  Checking if images need to be updated or installed...
  Checking if subuser bar is up to date.
  Installing bar ...
  Building...
  Building...
  Building...
  Successfully built 9
  Building...
  Building...
  Building...
  Successfully built 10
  Installed new image <10> for subuser bar
  Running garbage collector on temporary repositories...

  Now we have two subusers.

#.........这里部分代码省略.........
开发者ID:gh0std4ncer,项目名称:subuser,代码行数:101,代码来源:subuser.py



注:本文中的subuserlib.classes.user.getRegistry函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python userOwnedObject.UserOwnedObject类代码示例发布时间:2022-05-27
下一篇:
Python util.get_oid函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap