Skip to content
This repository has been archived by the owner on Jan 27, 2023. It is now read-only.

Re-adding a previously deleted image doesn't restore deactivated subscriptions #195

Closed
juledwar opened this issue May 15, 2019 · 1 comment
Assignees

Comments

@juledwar
Copy link

Is this a request for help?:
No

Is this a BUG REPORT or a FEATURE REQUEST? (choose one):
BUG REPORT

Version of Anchore Engine and Anchore CLI if applicable:
CLI: 0.4.0
Engine: 0.4.0

What happened:

$ anchore-cli subscription list|grep nginx
docker.io/nginx:latest                                  analysis_update          True          
docker.io/nginx:latest                                  policy_eval              False         
docker.io/nginx:latest                                  tag_update               True          
docker.io/nginx:latest                                  vuln_update              True

$ anchore-cli image del docker.io/nginx:latest
Error: cannot delete image that is the latest of its tags, and has active subscription
HTTP Code: 409
Detail: {u'error_codes': []}

$ anchore-cli subscription deactivate vuln_update docker.io/nginx:latest 
Success
$ anchore-cli subscription deactivate tag_update docker.io/nginx:latest 
Success
$ anchore-cli subscription deactivate analysis_update docker.io/nginx:latest 
Success

$ anchore-cli image del docker.io/nginx:latest
Success

$ anchore-cli subscription list|grep nginx
docker.io/nginx:latest                                  analysis_update          False         
docker.io/nginx:latest                                  policy_eval              False         
docker.io/nginx:latest                                  tag_update               False         
docker.io/nginx:latest                                  vuln_update              False

$ anchore-cli image add docker.io/nginx:latest
Image Digest: sha256:e770165fef9e36b990882a4083d8ccf5e29e469a8609bb6b2e3b47d9510e2c8d
Parent Digest: sha256:23b4dcdf0d34d4a129755fc6f52e1c6e23bb34ea011b315d87e193033bcd1b68
Analysis Status: not_analyzed
Image Type: docker
Image ID: 53f3fd8007f76bd23bf663ad5f5009c8941f63828ae458cef584b5f85dc0a7bf
Dockerfile Mode: None
Distro: None
Distro Version: None
Size: None
Architecture: None
Layer Count: None

Full Tag: docker.io/nginx:latest

$ anchore-cli subscription list|grep nginx
docker.io/nginx:latest                                  analysis_update          False         
docker.io/nginx:latest                                  policy_eval              False         
docker.io/nginx:latest                                  tag_update               False         
docker.io/nginx:latest                                  vuln_update              False         

What did you expect to happen:
I would expect that the autosubscription would re-activate these subscriptions. I cannot delete them from the CLI, only the API. They are only activated with the autosubscription request if they don't already exist.

@nurmi nurmi self-assigned this May 16, 2019
@nurmi
Copy link
Member

nurmi commented May 16, 2019

hi @juledwar - appreciate the report!

Agreed with your analysis, this behavior is a bit of a holdover from some previous internal complexities, but now we can fix the logic to honor the settings coming in from the API on image add for setting subscription values, regardless of the state of related subscription records.

@nurmi nurmi closed this as completed in 46bd2f8 May 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants