Skip to content

Commit

Permalink
Merge pull request #461 from adarshdubey-star/gce_cr_enhancement
Browse files Browse the repository at this point in the history
Adding functionality to pass projects while listing templates/images
  • Loading branch information
bsquizz authored Feb 28, 2023
2 parents 036f85a + 6835b48 commit f82fd2f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions wrapanapi/systems/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,15 @@ def get_vm(self, name, zone=None, try_all_zones=False):
def create_vm(self):
raise NotImplementedError

def list_templates(self, include_public=False):
def list_templates(self, include_public=False, public_projects=None):
images = self._compute.images()
results = []
projects = [self._project]
if include_public:
projects.extend(IMAGE_PROJECTS)
if public_projects:
projects.extend(public_projects)
else:
projects.extend(IMAGE_PROJECTS)
for project in projects:
results.extend(
GoogleCloudImage(system=self, raw=image, project=project, name=image['name'])
Expand Down

0 comments on commit f82fd2f

Please sign in to comment.