Esempio n. 1
0
 def test_get_databases_type(self):
     self._init_db()
     result = [v for v in api_scrooge.get_databases(
         database_type=self.databases[0].database_type.name
     )]
     databases_dict = map(self._db2api, self.databases[:1])
     self.assertEqual(result, databases_dict)
Esempio n. 2
0
 def test_get_databases_parent_service(self):
     self._init_db()
     result = [v for v in api_scrooge.get_databases(
         parent_service_uid=self.databases[0].parent_device.service.uid
     )]
     databases_dict = map(self._db2api, self.databases[:1])
     self.assertEqual(result, databases_dict)
Esempio n. 3
0
def database(today, **kwargs):
    new = total = 0
    for database_type in settings.DATABASE_TYPES:
        # check if unknown service environment is configured
        try:
            unknown_service_environment = get_unknown_service_environment(
                database_type
            )
        except UnknownServiceEnvironmentNotConfiguredError:
            logger.error(
                'Unknown service environment not configured for {}'.format(
                    database_type
                )
            )
        else:
            for ralph_database in api_scrooge.get_databases(
                database_type=database_type
            ):
                total += 1
                if update_database(
                    ralph_database,
                    today,
                    unknown_service_environment,
                ):
                    new += 1
    return True, 'Databases: {0} new, {1} updated, {2} total'.format(
        new,
        total - new,
        total,
    )
Esempio n. 4
0
def database(today, **kwargs):
    new = total = 0
    for database_type in settings.DATABASE_TYPES:
        # check if unknown service environment is configured
        try:
            unknown_service_environment = get_unknown_service_environment(
                database_type)
        except UnknownServiceEnvironmentNotConfiguredError:
            logger.error(
                'Unknown service environment not configured for {}'.format(
                    database_type))
        else:
            for ralph_database in api_scrooge.get_databases(
                    database_type=database_type):
                total += 1
                if update_database(
                        ralph_database,
                        today,
                        unknown_service_environment,
                ):
                    new += 1
    return True, 'Databases: {0} new, {1} updated, {2} total'.format(
        new,
        total - new,
        total,
    )
Esempio n. 5
0
 def test_get_databases(self):
     self._init_db()
     result = [v for v in api_scrooge.get_databases()]
     databases_dict = map(self._db2api, self.databases)
     self.assertEqual(result, databases_dict)