|
|
@ -54,14 +54,19 @@ angular.module('portainer.services')
|
|
|
|
return deferred.promise;
|
|
|
|
return deferred.promise;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function pullImageAndIgnoreErrors(imageConfiguration) {
|
|
|
|
service.pullImage = function(image, registry) {
|
|
|
|
|
|
|
|
var deferred = $q.defer();
|
|
|
|
var deferred = $q.defer();
|
|
|
|
|
|
|
|
|
|
|
|
var imageDetails = ImageHelper.extractImageAndRegistryFromRepository(image);
|
|
|
|
Image.create({}, imageConfiguration).$promise
|
|
|
|
var imageConfiguration = ImageHelper.createImageConfigForContainer(imageDetails.image, registry.URL);
|
|
|
|
.finally(function final() {
|
|
|
|
var authenticationDetails = registry.Authentication ? RegistryService.encodedCredentials(registry) : '';
|
|
|
|
deferred.resolve();
|
|
|
|
HttpRequestHelper.setRegistryAuthenticationHeader(authenticationDetails);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return deferred.promise;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function pullImageAndAcknowledgeErrors(imageConfiguration) {
|
|
|
|
|
|
|
|
var deferred = $q.defer();
|
|
|
|
|
|
|
|
|
|
|
|
Image.create({}, imageConfiguration).$promise
|
|
|
|
Image.create({}, imageConfiguration).$promise
|
|
|
|
.then(function success(data) {
|
|
|
|
.then(function success(data) {
|
|
|
@ -78,6 +83,18 @@ angular.module('portainer.services')
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return deferred.promise;
|
|
|
|
return deferred.promise;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
service.pullImage = function(image, registry, ignoreErrors) {
|
|
|
|
|
|
|
|
var imageDetails = ImageHelper.extractImageAndRegistryFromRepository(image);
|
|
|
|
|
|
|
|
var imageConfiguration = ImageHelper.createImageConfigForContainer(imageDetails.image, registry.URL);
|
|
|
|
|
|
|
|
var authenticationDetails = registry.Authentication ? RegistryService.encodedCredentials(registry) : '';
|
|
|
|
|
|
|
|
HttpRequestHelper.setRegistryAuthenticationHeader(authenticationDetails);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ignoreErrors) {
|
|
|
|
|
|
|
|
return pullImageAndIgnoreErrors(imageConfiguration);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return pullImageAndAcknowledgeErrors(imageConfiguration);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
service.tagImage = function(id, image, registry) {
|
|
|
|
service.tagImage = function(id, image, registry) {
|
|
|
|