Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
Fix/display name correctly in warning output (#52)
Browse files Browse the repository at this point in the history
* Correct variable name so container name is returned when asked for instead of always defaulting to ID

* Add .pyc files to ignore list
  • Loading branch information
kizzie authored and piontec committed Sep 27, 2018
1 parent 69b3e89 commit f9070a5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
__pycache__/
.idea/
.coverage
*.pyc
2 changes: 1 addition & 1 deletion dockerenforcer/docker_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, cid: str, params: Dict[str, Any], metrics: Dict[str, Any], po
self.owner: str = owner

def __str__(self, *args, **kwargs) -> str:
return self.params.get('Name', self.cid)
return self.params.get('name', self.cid)


class DockerHelper:
Expand Down
2 changes: 1 addition & 1 deletion test/test_docker_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_create_without_name(self):
self.assertEqual("123", str(container))

def test_create_with_name(self):
container = Container("123", {"Name": "container1"}, {"cpu": 7}, 0, CheckSource.Periodic)
container = Container("123", {"name": "container1"}, {"cpu": 7}, 0, CheckSource.Periodic)
self.assertEqual("container1", str(container))


Expand Down

0 comments on commit f9070a5

Please sign in to comment.