Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ public interface ListImagesCmd extends SyncDockerCmd<List<Image>> {

@CheckForNull
public String getFilters();

public String getImageNameFilter();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep new line before


@CheckForNull
public Boolean hasShowAllEnabled();

public ListImagesCmd withShowAll(Boolean showAll);

public ListImagesCmd withImageNameFilter(String imageName);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep new line after

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in latest commit.


public ListImagesCmd withFilters(String filters);

public static interface Exec extends DockerCmdSyncExec<ListImagesCmd, List<Image>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public boolean isPullSuccessIndicated() {
}

return (getStatus().contains("Download complete") || getStatus().contains("Image is up to date") || getStatus()
.contains("Downloaded newer image"));
.contains("Downloaded newer image") || getStatus().contains("this image was pulled from a legacy registry"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
public class ListImagesCmdImpl extends AbstrDockerCmd<ListImagesCmd, List<Image>> implements ListImagesCmd {

private String imageNameFilter;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong intent

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in latest commit.

private String filters;

private Boolean showAll = false;
Expand Down Expand Up @@ -48,4 +49,22 @@ public ListImagesCmd withFilters(String filter) {
return this;
}

@Override
public String toString() {
return new StringBuilder("images ").append(showAll ? "--all=true" : "")
.append(filters != null ? "--filters " + filters : "")
.append(imageNameFilter != null ? "--filter " + imageNameFilter : "").toString();
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just do toString from helpers (see some class), it was old idea to emulate command line.


@Override
public ListImagesCmd withImageNameFilter(String imageNameFilter) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(@Nonnull String

checkNotNull(imageNameFilter, "image name filter not specified");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcuslinke why enforce non null if it has null check later?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it was OK to check in exec as it coudn't "know" that this was checked already. When introducing @Nonnull annotation the checkNotNull is not needed anymore.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, annotation is source level, real check is runtime check.
If you want disable filter, then you can't nullify it as i understand. So probably checkNotNull and nonnull annotation could be just removed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

this.imageNameFilter = imageNameFilter;
return this;
}

@Override
public String getImageNameFilter() {
return this.imageNameFilter;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ protected List<Image> execute(ListImagesCmd command) {

webTarget = booleanQueryParam(webTarget, "all", command.hasShowAllEnabled());

if (command.getFilters() != null)
webTarget = webTarget.queryParam("filters", urlPathSegmentEscaper().escape(command.getFilters()));
if (command.getFilters() != null) {
webTarget = webTarget.queryParam("filters", urlPathSegmentEscaper().escape(command.getFilters()));
}

if (command.getImageNameFilter() != null) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So null allowed?

webTarget = webTarget.queryParam("filter", urlPathSegmentEscaper().escape(command.getImageNameFilter()));
}

LOGGER.trace("GET: {}", webTarget);

Expand Down