mirror of https://github.com/docker/docs.git
Add a lookup before pushing repository to check permissions
This commit is contained in:
parent
84cca8afc8
commit
161526d99d
|
@ -370,11 +370,10 @@ func (graph *Graph) pushPrimitive(stdout io.Writer, remote, tag, imgId string, a
|
||||||
// Push a repository to the registry.
|
// Push a repository to the registry.
|
||||||
// Remote has the format '<user>/<repo>
|
// Remote has the format '<user>/<repo>
|
||||||
func (graph *Graph) PushRepository(stdout io.Writer, remote string, localRepo Repository, authConfig *auth.AuthConfig) error {
|
func (graph *Graph) PushRepository(stdout io.Writer, remote string, localRepo Repository, authConfig *auth.AuthConfig) error {
|
||||||
// Check if the remote repository exists
|
// Check if the remote repository exists/if we have the permission
|
||||||
// FIXME: @lopter How to handle this?
|
if !graph.LookupRemoteRepository(remote, authConfig) {
|
||||||
// if !graph.LookupRemoteRepository(remote, authConfig) {
|
return fmt.Errorf("Permission denied on repository %s\n", remote)
|
||||||
// return fmt.Errorf("The remote repository %s does not exist\n", remote)
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
fmt.Fprintf(stdout, "Pushing repository %s (%d tags)\n", remote, len(localRepo))
|
fmt.Fprintf(stdout, "Pushing repository %s (%d tags)\n", remote, len(localRepo))
|
||||||
// For each image within the repo, push them
|
// For each image within the repo, push them
|
||||||
|
|
Loading…
Reference in New Issue