Skip to content

Commit

Permalink
Merge pull request #673 from prancer-io/development
Browse files Browse the repository at this point in the history
Fixed bugs in GCP crawler
  • Loading branch information
vatsalgit5118 authored May 19, 2023
2 parents d33ddb2 + 67e79a0 commit 7f26002
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
setup(
name='prancer-basic',
# also update the version in processor.__init__.py file
version='3.0.5',
version='3.0.6',
description='Prancer Basic, http://prancer.io/',
long_description=LONG_DESCRIPTION,
license = "BSD",
Expand Down
2 changes: 1 addition & 1 deletion src/processor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Prancer Basic

__version__ = '3.0.5'
__version__ = '3.0.6'
9 changes: 4 additions & 5 deletions src/processor/connector/snapshot_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,14 +625,13 @@ def populate_google_snapshot(snapshot, container=None):
if valid_snapshotids and sub_data and snapshot_nodes:
logger.debug(sub_data)
try:
credentials = get_google_client_data(sub_data, snapshot_user, "", project_id)
if not credentials:
logger.info("No GCE connection in the snapshot to access Google resource!...")
return snapshot_data
for node in snapshot['nodes']:
validate = node['validate'] if 'validate' in node else True
logger.info(node)
node_type = get_field_value_with_default(node, 'type',"")
credentials = get_google_client_data(sub_data, snapshot_user, node_type, project_id)
if not credentials:
logger.info("No GCE connection in the snapshot to access Google resource!...")
return snapshot_data
if 'snapshotId' in node:
if validate:
data = get_node(credentials, node, snapshot_source, snapshot)
Expand Down
4 changes: 2 additions & 2 deletions src/processor/crawler/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def populate_gcp_projects(container, source, structure_data):
client_id = user["client_id"]
private_key_id = user["private_key_id"]
name = user["name"]
private_key = user["private_key"]
private_key = user.get("private_key")
name = re.sub(r"-\d+$", "", name)
account_list += get_projects_list(private_key_id, private_key, client_email, client_id, name)
updated_data = copy.deepcopy(structure_data)
Expand Down Expand Up @@ -201,7 +201,7 @@ def get_projects_list(private_key_id, private_key, client_email, client_id, test
new_private_key = private_key

if new_private_key:
access_token = access_token_from_service_account(private_key_id, private_key, client_email, client_id)
access_token = access_token_from_service_account(private_key_id, new_private_key, client_email, client_id)
if access_token:
hdrs = {"Accept": "application/json", "Authorization": "Bearer %s" % access_token }
url = "https://cloudresourcemanager.googleapis.com/v1/projects"
Expand Down

0 comments on commit 7f26002

Please sign in to comment.