On Tue, 2015-06-16 at 19:53 +0200, Thomas H.P. Andersen wrote: > On Thu, May 7, 2015 at 5:47 PM, Pavel Odvody <[email protected]> wrote: > > Signed-off-by: Pavel Odvody <[email protected]> > > --- > > src/import/pull.c | 28 +++++++++++++++++----------- > > 1 file changed, 17 insertions(+), 11 deletions(-) > > > > diff --git a/src/import/pull.c b/src/import/pull.c > > index ef7b035..8054612 100644 > > --- a/src/import/pull.c > > +++ b/src/import/pull.c > > @@ -227,7 +227,7 @@ static void on_dkr_finished(DkrPull *pull, int error, > > void *userdata) { > > static int pull_dkr(int argc, char *argv[], void *userdata) { > > _cleanup_(dkr_pull_unrefp) DkrPull *pull = NULL; > > _cleanup_event_unref_ sd_event *event = NULL; > > - const char *name, *tag, *local; > > + const char *name, *reference, *local, *digest; > > int r; > > > > if (!arg_dkr_index_url) { > > @@ -240,13 +240,19 @@ static int pull_dkr(int argc, char *argv[], void > > *userdata) { > > return -EINVAL; > > } > > > > - tag = strchr(argv[1], ':'); > > - if (tag) { > > - name = strndupa(argv[1], tag - argv[1]); > > - tag++; > > + digest = strchr(argv[1], '@'); > > + if (digest) { > > + reference = digest + 1; > > + name = strndupa(argv[1], digest - argv[1]); > > + } > > + > > + reference = strchr(argv[1], ':'); > > + if (reference) { > > + name = strndupa(argv[1], reference - argv[1]); > > + reference++; > > } else { > > name = argv[1]; > > - tag = "latest"; > > + reference = "latest"; > > } > > This part does not look correct. Any value that we set for > reference/name in the digest part will be overwritten in the next > block. I do not know the format of the string so I cannot create a > patch for this. Can you take a look Pavel? >
I think you're right, will take a look later today and submit a patch.
The digest reference looks like this:
fedora@sha256:cc47966101aeba8015c933f9c3854811a27363f93fa4e0e52e6c55181c56c66c
> >
> > if (!dkr_name_is_valid(name)) {
> > @@ -254,8 +260,8 @@ static int pull_dkr(int argc, char *argv[], void
> > *userdata) {
> > return -EINVAL;
> > }
> >
> > - if (!dkr_tag_is_valid(tag)) {
> > - log_error("Tag name '%s' is not valid.", tag);
> > + if (!dkr_ref_is_valid(reference)) {
> > + log_error("Tag name '%s' is not valid.", reference);
> > return -EINVAL;
> > }
> >
> > @@ -288,9 +294,9 @@ static int pull_dkr(int argc, char *argv[], void
> > *userdata) {
> > }
> > }
> >
> > - log_info("Pulling '%s' with tag '%s', saving as '%s'.",
> > name, tag, local);
> > + log_info("Pulling '%s' with reference '%s', saving as
> > '%s'.", name, reference, local);
> > } else
> > - log_info("Pulling '%s' with tag '%s'.", name, tag);
> > + log_info("Pulling '%s' with reference '%s'.", name,
> > reference);
> >
> > r = sd_event_default(&event);
> > if (r < 0)
> > @@ -304,7 +310,7 @@ static int pull_dkr(int argc, char *argv[], void
> > *userdata) {
> > if (r < 0)
> > return log_error_errno(r, "Failed to allocate puller: %m");
> >
> > - r = dkr_pull_start(pull, name, tag, local, arg_force);
> > + r = dkr_pull_start(pull, name, reference, local, arg_force,
> > PULL_V2);
> > if (r < 0)
> > return log_error_errno(r, "Failed to pull image: %m");
> >
> > --
> > 2.1.0
> >
> >
> >
> >
> > _______________________________________________
> > systemd-devel mailing list
> > [email protected]
> > http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> >
--
Pavel Odvody <[email protected]>
Software Engineer - EMEA ENG Developer Experience
5EC1 95C1 8E08 5BD9 9BBF 9241 3AFA 3A66 024F F68D
Red Hat Czech s.r.o., Purkyňova 99/71, 612 45, Brno
signature.asc
Description: This is a digitally signed message part
_______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
