Skip to content

Commit 4c18be1

Browse files
authored
Fixing -p/-f option and printing (#320)
* Fixing -p/-f option and printing * Fixing pylint errorS
1 parent f672277 commit 4c18be1

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/gcp_scanner/credsdb.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def find_creds(explicit_path: Optional[str] = None) -> List[str]:
189189
search_paths.append(full_path)
190190

191191
for dir_path in search_paths:
192-
logging.info(f"Scanning {dir_path} for credentials.db")
192+
logging.info("Scanning %s for credentials.db", dir_path)
193193
full_path = os.path.join(dir_path, "credentials.db")
194194
if os.path.exists(full_path) and os.access(full_path, os.R_OK):
195195
print(f"Identified accessible gcloud config profile {full_path}")

src/gcp_scanner/scanner.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def impersonate_service_accounts(
328328

329329
# trying to impersonate SAs within project
330330
if impers is not None and impers.get('impersonate', False) is True:
331-
logging.info(f'Looking for impersonation options in {project_id}')
331+
logging.info('Looking for impersonation options in %s', project_id)
332332
iam_client = iam_client_for_credentials(credentials)
333333
if is_set(scan_config, 'iam_policy') is False:
334334
iam_policy = CrawlerFactory.create_crawler('iam_policy').crawl(
@@ -570,13 +570,14 @@ def main():
570570
(
571571
item
572572
for item in project_list
573-
if item["projectId"] == force_project_id
573+
if item['projectId'] == force_project_id
574574
),
575575
None,
576576
)
577577
is not None
578578
):
579-
logging.info(f"The project {force_project_id} is already in the list")
579+
logging.info('The project %s is already in the list',
580+
force_project_id)
580581
continue
581582
res = CrawlerFactory.create_crawler(
582583
'project_info',
@@ -624,7 +625,7 @@ def main():
624625

625626
# See i#267 on why we use the native threading approach here.
626627
for i, project_obj in enumerate(project_queue):
627-
logging.info('Finished %d projects out of %d' % (i, len(project_queue) - 1))
628+
logging.info('Finished %d projects out of %d', i, len(project_queue) - 1)
628629
sync_t = threading.Thread(target=scanner.get_resources, args=(project_obj,))
629630
sync_t.daemon = True
630631
sync_t.start()

0 commit comments

Comments
 (0)