Skip to content

Commit

Permalink
Merge pull request #3 from OpenLMIS-Angola/hotfix/import_ssh_tunnel
Browse files Browse the repository at this point in the history
Fixed behavior for no ssh setup
  • Loading branch information
malinowskikam authored Jun 19, 2024
2 parents a0ecfad + df39060 commit ed425f9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/data_sync_microservice-docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Push Docker Image For Sigeca Data Export Microservice
name: Docker Image Deployment For Microservices

on:
push:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def __init__(self, config: Any):
.getOrCreate()
)
self.spark.sparkContext.setLogLevel(config.get("log_level", "WARN"))
self.tunnel = None

def setup_ssh_tunnel(self):
self.tunnel = SSHTunnelForwarder(
Expand Down
4 changes: 2 additions & 2 deletions sigeca_data_import_microservice/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _run_scheduler(sync_service, sync_interval_minutes):
ProgramResourceRepository(jdbc_reader),
)
try:
if config["jdbc_reader"]["ssh_user"]:
if config["jdbc_reader"].get("ssh_user"):
jdbc_reader.setup_ssh_tunnel()
lmis_client.login()

Expand All @@ -71,5 +71,5 @@ def _run_scheduler(sync_service, sync_interval_minutes):
except Exception as e:
logging.exception(e)
finally:
if config["jdbc_reader"]["ssh_user"]:
if config["jdbc_reader"].get("ssh_user"):
jdbc_reader.close_ssh_tunnel()

0 comments on commit ed425f9

Please sign in to comment.