Exemple #1
0
 def get(self, _req, **_):
     """
     @api {get} /registry/ Get Repository list
     @apiName GetRepositories
     @apiGroup RegistryManager
     @apiVersion 0.1.0
     @apiPermission admin
     @apiSuccess {Object} payload Response Object
     @apiSuccess {Number} payload.count Count of total repositories
     @apiSuccess {Object[]} payload.entry List of Repositoris
     @apiSuccess {String} payload.entry.Repo Repository Name
     @apiUse APIHeader
     @apiUse Success
     @apiUse OperationFailed
     @apiUse Unauthorized
     """
     response = RESPONSE.SUCCESS
     try:
         response['payload']['entity'] = []
         dxfbase = DXFBase(REGISTRY_ADDRESS)
         for repository in dxfbase.list_repos():
             response['payload']['entity'].append(
                 self.util.get_repository(repository))
         response['payload']['count'] = len(response['payload']['entity'])
         return JsonResponse(response)
     except Exception as ex:
         LOGGER.exception(ex)
         return JsonResponse(RESPONSE.OPERATION_FAILED)
Exemple #2
0
    def __init__(self, host, auth=None, insecure=False, auth_host=None):
        """
        :param host: Host name of registry. Can contain port numbers. e.g. ``registry-1.docker.io``, ``localhost:5000``.
        :type host: str

        :param auth: Authentication function to be called whenever authentication to the registry is required. Receives the :class:`DTufBase` object and a HTTP response object. It should call :meth:`authenticate` on ``dtuf_obj`` with a username, password and ``response`` before it returns.
        :type auth: function(dtuf_obj, response)

        :param insecure: Use HTTP instead of HTTPS (which is the default) when connecting to the registry.
        :type insecure: bool

        :param auth_host: Host to use for token authentication. If set, overrides host returned by then registry.
        :type auth_host: str
        """
        self._dxf = DXFBase(host, self._wrap_auth(auth), insecure, auth_host)
Exemple #3
0
parser.add_argument('-f',
                    '--from',
                    required=True,
                    type=address_with_credentials,
                    dest='source')
parser.add_argument('-t',
                    '--to',
                    required=True,
                    type=address_with_credentials,
                    dest='destination')
parser.add_argument('-i', '--insecure', action='store_false', dest='tlsverify')
parser.set_defaults(tlsverify=True)
args = parser.parse_args()

source = DXFBase(args.source.address,
                 auth=args.source.auth,
                 tlsverify=args.tlsverify)
source_repositories = source.list_repos()
destination = DXFBase(args.destination.address,
                      auth=args.destination.auth,
                      tlsverify=args.tlsverify)
destination_repositories = destination.list_repos()

for repository in source_repositories:
    source_repository = DXF.from_base(source, repository)
    destination_repository = DXF.from_base(destination, repository)

    try:
        tags = source_repository.list_aliases()
    except DXFUnauthorizedError:
        print(