def check_alerts(monitor: SdMonitorClient, path: AnyStr) -> bool: something_changed = False with open(os.path.join(path, BACKUP_RESTORE_FILES.ALERTS)) as alerts_file: ok, remote_alerts = monitor.get_alerts() if not ok: raise Exception("error retrieving the alerts") local_alerts = json.load(alerts_file) equal = utils.are_jsons_equal(local_alerts, remote_alerts) if not equal: something_changed = True print("alerts differ") else: print("alerts are the same") return something_changed
def check_users(monitor: SdMonitorClient, path: AnyStr) -> bool: something_changed = False with open(os.path.join(path, BACKUP_RESTORE_FILES.USERS)) as users_file: ok, remote_users = monitor.get_users() if not ok: raise Exception("could not retrieve users") local_users = json.load(users_file) equal = utils.are_jsons_equal(local_users, remote_users) if not equal: something_changed = True print("users differ") else: print("users are the same") return something_changed
def check_policies(sdsecure: SdSecureClient, path: AnyStr) -> bool: something_changed = False with open(os.path.join(path, BACKUP_RESTORE_FILES.POLICIES)) as policies_file: ok, remote_policies = sdsecure.list_policies() if not ok: raise Exception("unable to retrieve policies") local_policies = json.load(policies_file) equal = utils.are_jsons_equal(local_policies, remote_policies) if not equal: something_changed = True print("policies differ") else: print("policies are the same") return something_changed
def check_teams_monitor(monitor: SdMonitorClient, path: AnyStr) -> bool: something_changed = False with open(os.path.join(path, BACKUP_RESTORE_FILES.TEAMS_MONITOR)) as teams_file: ok, remote_teams = monitor.get_all_teams() if not ok: raise Exception("could not retrieve teams") local_teams = json.load(teams_file) equal = utils.are_jsons_equal(local_teams, remote_teams) if not equal: something_changed = True print("teams differ") else: print("teams are the same") return something_changed
def check_dashboards(sdmonitor: SdMonitorClient, path: AnyStr) -> bool: something_changed = False with open(os.path.join( path, BACKUP_RESTORE_FILES.DASHBOARDS)) as dashboards_file: ok, remote_dashboards = sdmonitor.get_dashboards() if not ok: raise Exception("error retrieving the dashboards") local_dashboards = json.load(dashboards_file) equal = utils.are_jsons_equal(remote_dashboards, local_dashboards) if not equal: something_changed = True print("dashboards differ") else: print("dashboards are the same") return something_changed
def check_user_falco_rules(sdsecure: SdSecureClient, path: AnyStr) -> bool: something_changed = False with open(os.path.join( path, BACKUP_RESTORE_FILES.USER_FALCO_RULES)) as falco_rules_file: ok, remote_falco_rules = sdsecure.get_user_falco_rules() if not ok: raise Exception("could not retrieve user falco rules") local_falco_rules = json.load(falco_rules_file) equal = utils.are_jsons_equal(local_falco_rules, remote_falco_rules) if not equal: something_changed = True print("falco rules differ") else: print("falco rules are the same") return something_changed
def check_notification_channels(monitor: SdMonitorClient, path: AnyStr) -> bool: something_changed = False with open(os.path.join(path, BACKUP_RESTORE_FILES.NOTIFICATION_CHANNELS) ) as notification_channels_file: ok, remote_notification_channels = monitor.get_notification_channels() if not ok: raise Exception("could not retrieve notification channels") local_notification_channels = json.load(notification_channels_file) equal = utils.are_jsons_equal(local_notification_channels, remote_notification_channels) if not equal: something_changed = True print("notification channels differ") else: print("notification channels are the same") return something_changed