Skip to content

Commit 5e8e87b

Browse files
committed
Set logging level to INFO for management commands
Also replaced deprecated `logger.warn()` with `logger.warning()`
1 parent 772cd9f commit 5e8e87b

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

src/coldfront_plugin_cloud/management/commands/convert_swift_quota_to_gib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from coldfront.core.resource.models import Resource, ResourceType
99
from coldfront.core.allocation.models import Allocation, AllocationStatusChoice
1010

11+
logging.basicConfig(level=logging.INFO)
1112
logger = logging.getLogger(__name__)
1213

1314

src/coldfront_plugin_cloud/management/commands/count_gpu_usage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from coldfront.core.resource.models import Resource, ResourceType
1010
from coldfront.core.allocation.models import Allocation, AllocationStatusChoice
1111

12-
12+
logging.basicConfig(level=logging.INFO)
1313
logger = logging.getLogger(__name__)
1414

1515

src/coldfront_plugin_cloud/management/commands/list_cloud_allocations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from coldfront.core.resource.models import Resource, ResourceType
1111
from coldfront.core.allocation.models import Allocation, AllocationStatusChoice
1212

13-
13+
logging.basicConfig(level=logging.INFO)
1414
logger = logging.getLogger(__name__)
1515

1616

src/coldfront_plugin_cloud/management/commands/migrate_fields_of_science.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import logging
88

9-
9+
logging.basicConfig(level=logging.INFO)
1010
logger = logging.getLogger(__name__)
1111

1212

@@ -56,7 +56,7 @@ def _load_fos_map(mapping_csv):
5656
def _validate_old_fos(mapping_dict):
5757
for old_fos_name in list(mapping_dict.keys()):
5858
if not FieldOfScience.objects.filter(description=old_fos_name):
59-
logger.warn(f"Old field of science {old_fos_name} does not exist")
59+
logger.warning(f"Old field of science {old_fos_name} does not exist")
6060

6161
@staticmethod
6262
def _create_new_fos(new_fos_set):

src/coldfront_plugin_cloud/management/commands/register_cloud_attributes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from coldfront_plugin_cloud import attributes
99

10+
logging.basicConfig(level=logging.INFO)
1011
logger = logging.getLogger(__name__)
1112

1213

src/coldfront_plugin_cloud/management/commands/validate_allocations.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
)
1616
from keystoneauth1.exceptions import http
1717

18-
18+
logging.basicConfig(level=logging.INFO)
1919
logger = logging.getLogger(__name__)
2020

2121
STATES_TO_VALIDATE = ["Active", "Active (Needs Renewal)"]
@@ -43,7 +43,7 @@ def sync_users(project_id, allocation, allocator, apply):
4343
for coldfront_user in coldfront_users:
4444
if coldfront_user.user.username not in allocation_users:
4545
failed_validation = True
46-
logger.warn(
46+
logger.warning(
4747
f"{coldfront_user.user.username} is not part of {project_id}"
4848
)
4949
if apply:
@@ -56,7 +56,7 @@ def sync_users(project_id, allocation, allocator, apply):
5656
for allocation_user in allocation_users:
5757
if allocation_user not in users:
5858
failed_validation = True
59-
logger.warn(
59+
logger.warning(
6060
f"{allocation_user} exists in the resource {project_id} but not in coldfront"
6161
)
6262
if apply:
@@ -97,10 +97,10 @@ def check_institution_specific_code(self, allocation, apply):
9797
if not isc:
9898
alloc_str = f'{allocation.pk} of project "{allocation.project.title}"'
9999
msg = f'Attribute "{attr}" missing on allocation {alloc_str}'
100-
logger.warn(msg)
100+
logger.warning(msg)
101101
if apply:
102102
utils.set_attribute_on_allocation(allocation, attr, "N/A")
103-
logger.warn(f'Attribute "{attr}" added to allocation {alloc_str}')
103+
logger.warning(f'Attribute "{attr}" added to allocation {alloc_str}')
104104

105105
def handle(self, *args, **options):
106106
# Deal with Openstack and ESI resources

0 commit comments

Comments
 (0)