Skip to content

Commit

Permalink
release 0.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jldupont committed Jul 22, 2024
1 parent 1194dbf commit 978d8de
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# @author: jldupont
#
RELEASE=0.0.3
RELEASE=0.0.4

SHELL := /bin/bash
RED=\033[1;31m
Expand Down
9 changes: 4 additions & 5 deletions src/cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,15 @@ def get_cmd_cloud_run_job_create_or_update(config: Config,
"--region", config.JobRegion,
"--image", "docker.io/jldupont/gcp-inventory:latest",
"--set-env-vars",
f"TARGETPROJECTID={config.TargetProjectId}",
"--set-env-vars", f"LOCATIONS={config.TargetLocations}",
"--set-env-vars", f"TARGETBUCKET={config.TargetBucket}",
"--set-env-vars",
f"TARGETPROJECTID={config.TargetProjectId},"
f"TARGETLOCATIONS={config.TargetLocations},"
f"TARGETBUCKET={config.TargetBucket},"
f"TARGETBUCKETPROJECT={config.TargetBucketProject}",
OptionalParam("--service-account",
config.ServiceAccountEmail),
cmd="gcloud",
exit_on_error=False,
log_error=False)
log_error=True)


def deploy_cloud_run_job(config: Config, already_exists: bool) -> Result:
Expand Down
2 changes: 2 additions & 0 deletions src/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@ class Config(_Base):
ServiceAccountEmail: Union[str, None] = field(default=None)

def __post_init__(self):
if self.Schedule is None:
return
if not croniter.is_valid(self.Schedule):
raise ValueError("Invalid schedule")
3 changes: 2 additions & 1 deletion src/proc_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def run(path: str = 'config.yaml'):
info(f" Project number: {project_description.projectNumber}")
config.ProjectNumber = project_description.projectNumber

info(f"* Checking if bucket '{config.TargetBucket}' exists")
info(f"* Checking if bucket '{config.TargetBucket}' "
"in project '{config.TargetBucketProject}' exists")
if not check_if_bucket_exists(config):
abort("The bucket does not exist. Please create it first")

Expand Down
4 changes: 2 additions & 2 deletions src/proc_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def list_with_locations(project: str,

all_entries: List[Spec] = []

location_list: List[str] = locations.split(",")
location_list: List[str] = locations.split(";")
location: str

for location in location_list:
Expand Down Expand Up @@ -71,7 +71,7 @@ def run(path: str = 'config.yaml'):

bucket = config.TargetBucket
bucket_project = config.TargetBucketProject
locations: List[str] = config.TargetLocations
locations: str = config.TargetLocations

info(f"> Inventoring project: {config.TargetProjectId}")
info(f"> Bucket: gs://{bucket} in project '{bucket_project}'")
Expand Down
2 changes: 1 addition & 1 deletion src/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_parse_config(sample_config):

assert config.ProjectId == "PROJECT_NOT_SET"
assert isinstance(config.TargetLocations, str)
assert len(config.TargetLocations.split(",")) == 2
assert len(config.TargetLocations.split(";")) == 2


def test_config_from_environment():
Expand Down

0 comments on commit 978d8de

Please sign in to comment.