Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/mas/devops/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import os
import yaml
from openshift.dynamic import DynamicClient
from openshift.dynamic.exceptions import NotFoundError
from openshift.dynamic.exceptions import NotFoundError, ResourceNotFoundError
import boto3
from botocore.exceptions import ClientError, NoCredentialsError

Expand Down Expand Up @@ -244,7 +244,7 @@ def backupResources(

return (backed_up_count, not_found_count, failed_count, discovered_secrets)

except NotFoundError:
except (NotFoundError, ResourceNotFoundError):
if name:
logger.info(f"{kind} '{name}' not found in {scope_desc}")
not_found_count = 1
Expand Down
5 changes: 4 additions & 1 deletion src/mas/devops/restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import logging
import yaml
from openshift.dynamic import DynamicClient
from openshift.dynamic.exceptions import NotFoundError
from openshift.dynamic.exceptions import NotFoundError, ResourceNotFoundError

logger = logging.getLogger(name=__name__)

Expand Down Expand Up @@ -125,6 +125,9 @@ def restoreResource(dynClient: DynamicClient, resource_data: dict, namespace=Non
logger.error(error_msg)
return (False, resource_name, error_msg)

except ResourceNotFoundError:
return (True, resource_data.get("kind"), "skipped")

except Exception as e:
error_msg = f"Error restoring resource: {e}"
logger.error(error_msg)
Expand Down
8 changes: 8 additions & 0 deletions src/mas/devops/templates/pipelinerun-backup.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ spec:
- name: manage_workspace_id
value: "{{ manage_workspace_id }}"
{% endif %}
{% if backup_manage_include_pvc is defined and backup_manage_include_pvc != "" %}
- name: backup_manage_include_pvc
value: "{{ backup_manage_include_pvc }}"
{% endif %}

# Manage Db2 Backup Configuration
{% if manage_db2_namespace is defined and manage_db2_namespace != "" %}
Expand Down Expand Up @@ -178,6 +182,10 @@ spec:
- name: facilities_workspace_id
value: "{{ facilities_workspace_id }}"
{% endif %}
{% if backup_facilities_include_pvc is defined and backup_facilities_include_pvc != "" %}
- name: backup_facilities_include_pvc
value: "{{ backup_facilities_include_pvc }}"
{% endif %}

# Facilities Db2 Backup Configuration
{% if facilities_db2_namespace is defined and facilities_db2_namespace != "" %}
Expand Down
8 changes: 8 additions & 0 deletions src/mas/devops/templates/pipelinerun-restore.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ spec:
- name: restore_manage_db
value: "{{ restore_manage_db }}"
{% endif %}
{% if restore_manage_include_pvc is defined and restore_manage_include_pvc != "" %}
- name: restore_manage_include_pvc
value: "{{ restore_manage_include_pvc }}"
{% endif %}
# Manage App Storage class
{% if manage_app_override_storageclass is defined and manage_app_override_storageclass != "" %}
- name: manage_app_override_storageclass
Expand Down Expand Up @@ -246,6 +250,10 @@ spec:
- name: restore_facilities_db
value: "{{ restore_facilities_db }}"
{% endif %}
{% if restore_facilities_include_pvc is defined and restore_facilities_include_pvc != "" %}
- name: restore_facilities_include_pvc
value: "{{ restore_facilities_include_pvc }}"
{% endif %}
# Facilities App Storage class
{% if facilities_app_override_storageclass is defined and facilities_app_override_storageclass != "" %}
- name: facilities_app_override_storageclass
Expand Down
Loading