|
12 | 12 |
|
13 | 13 | RUNTIME = os.getenv('RUNTIME')
|
14 | 14 | APPLICATION = os.getenv('APPLICATION')
|
| 15 | +APP_NAMESPACE = os.getenv('APP_NAMESPACE') |
| 16 | + |
| 17 | +APP_DICTIONARY = { |
| 18 | + "applicationName": APPLICATION, |
| 19 | +} |
| 20 | +if APP_NAMESPACE is not None: |
| 21 | + APP_DICTIONARY["applicationNamespace"] = APP_NAMESPACE |
| 22 | + |
15 | 23 |
|
16 | 24 | # Wait and Rollback options
|
17 | 25 | WAIT_HEALTHY = True if os.getenv('WAIT_HEALTHY', "false").lower() == "true" else False
|
@@ -43,6 +51,7 @@ def main():
|
43 | 51 |
|
44 | 52 | logging.debug("RUNTIME: %s", RUNTIME)
|
45 | 53 | logging.debug("APPLICATION: %s", APPLICATION)
|
| 54 | + logging.debug("NAMESPACE: %s", NAMESPACE) |
46 | 55 | logging.debug("WAIT: %s", WAIT_HEALTHY)
|
47 | 56 | logging.debug("INTERVAL: %d", INTERVAL)
|
48 | 57 | logging.debug("MAX CHECKS: %s", MAX_CHECKS)
|
@@ -214,9 +223,7 @@ def get_app_status(ingress_host):
|
214 | 223 | )
|
215 | 224 | client = Client(transport=transport, fetch_schema_from_transport=False)
|
216 | 225 | query = get_query('get_app_status') ## gets gql query
|
217 |
| - variables = { |
218 |
| - "name": APPLICATION |
219 |
| - } |
| 226 | + variables = {**APP_DICTIONARY} |
220 | 227 | result = client.execute(query, variable_values=variables)
|
221 | 228 |
|
222 | 229 | logging.debug("App Status result: %s", result)
|
@@ -276,12 +283,14 @@ def execute_argocd_sync(ingress_host):
|
276 | 283 | )
|
277 | 284 | client = Client(transport=transport, fetch_schema_from_transport=False)
|
278 | 285 | query = get_query('argocd_sync') ## gets gql query
|
| 286 | + |
279 | 287 | variables = {
|
280 |
| - "applicationName": APPLICATION, |
| 288 | + **APP_DICTIONARY, |
281 | 289 | "options": {
|
282 | 290 | "prune": True
|
283 | 291 | }
|
284 | 292 | }
|
| 293 | + |
285 | 294 | try:
|
286 | 295 | result = client.execute(query, variable_values=variables)
|
287 | 296 | except TransportQueryError as err:
|
@@ -312,9 +321,7 @@ def application_exist(ingress_host):
|
312 | 321 | )
|
313 | 322 | client = Client(transport=transport, fetch_schema_from_transport=False)
|
314 | 323 | query = get_query('get_app_existence') ## gets gql query
|
315 |
| - variables = { |
316 |
| - "applicationName": APPLICATION |
317 |
| - } |
| 324 | + variables = {**APP_DICTIONARY} |
318 | 325 | try:
|
319 | 326 | result = client.execute(query, variable_values=variables)
|
320 | 327 | except TransportQueryError as err:
|
@@ -346,9 +353,7 @@ def application_autosync(ingress_host):
|
346 | 353 | )
|
347 | 354 | client = Client(transport=transport, fetch_schema_from_transport=False)
|
348 | 355 | query = get_query('get_app_autosync') ## gets gql query
|
349 |
| - variables = { |
350 |
| - "applicationName": APPLICATION |
351 |
| - } |
| 356 | + variables = {**APP_DICTIONARY} |
352 | 357 | try:
|
353 | 358 | result = client.execute(query, variable_values=variables)
|
354 | 359 | except Exception as err:
|
|
0 commit comments