Skip to content

Commit

Permalink
fix: image splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
devopstales committed Feb 1, 2023
1 parent c9de73d commit cbb62b7
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions trivy-operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,10 +600,10 @@ def delete_policyreports(namespace, name):
docker_registry = "docker.io"
try:
docker_image_part = image_name.split('/', 1)[1]
docker_image = docker_image_part.split(':')[0]
except:
docker_image = docker_image_part.split(':')[0]
docker_tag = image_name.split(':')[-1]
docker_image_part = image_name.split('/')[1]
docker_image = docker_image_part.split(':')[0]
docker_tag = docker_image_part.split(':')[1]

trivy_result = trivy_result_list[image_name]
#logger.debug(trivy_result) # debug
Expand Down Expand Up @@ -811,10 +811,16 @@ def delete_policyreports(namespace, name):
image = vul_list[pod_name][2]
pod_uid = vul_list[pod_name][3]

image_registry = image.split('/')[0]
image_part_name = image.split('/', 1)[1]
if validators.domain(image.split('/')[0]):
image_registry = image.split('/')[0]
else:
image_registry = "docker.io"
try:
image_part_name = image.split('/', 1)[1]
except:
image_part_name = image.split('/')[1]
image_name = image_part_name.split(':')[0]
image_tag = image.split(':')[1]
image_tag = image_part_name.split(':')[1]

criticalCount = vuls['CRITICAL']
highCount = vuls['HIGH']
Expand Down

0 comments on commit cbb62b7

Please sign in to comment.