Skip to content

Commit

Permalink
changed from exception to warning
Browse files Browse the repository at this point in the history
  • Loading branch information
ammokhov committed Jul 21, 2020
1 parent eccf0d5 commit cf31c37
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/rpdk/core/data_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def load_resource_spec(resource_spec_file): # noqa: C901

primary_id = resource_spec["primaryIdentifier"]
if not in_readonly(primary_id) and not in_createonly(primary_id):
raise SpecValidationError(

This comment has been minimized.

Copy link
@anshikg

anshikg Jul 21, 2020

Contributor

why do we want to change this to warning?

LOG.warning(
"Property 'primaryIdentifier' must be specified \
as either readOnly or createOnly"
)
Expand Down
2 changes: 1 addition & 1 deletion src/rpdk/core/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def safewrite(self, path, contents):
else:
f.write(contents)
except FileExistsError:
LOG.warning("File already exists, not overwriting '%s'", path)
LOG.info("File already exists, not overwriting '%s'", path)

def generate(self):
# generate template for IAM role assumed by cloudformation
Expand Down
4 changes: 3 additions & 1 deletion tests/test_project.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# fixture and parameter have the same name
# pylint: disable=redefined-outer-name,useless-super-delegation,protected-access
import json
import logging
import os
import random
import string
Expand Down Expand Up @@ -174,6 +175,7 @@ def test_safewrite_doesnt_exist(project, tmpdir):


def test_safewrite_exists(project, tmpdir, caplog):
caplog.set_level(logging.INFO)
path = Path(tmpdir.join("test")).resolve()

with path.open("w", encoding="utf-8") as f:
Expand All @@ -183,7 +185,7 @@ def test_safewrite_exists(project, tmpdir, caplog):
project.safewrite(path, CONTENTS_UTF8)

last_record = caplog.records[-1]
assert last_record.levelname == "WARNING"
assert last_record.levelname == "INFO"
assert str(path) in last_record.message


Expand Down

0 comments on commit cf31c37

Please sign in to comment.