Skip to content

Commit aa3b2fe

Browse files
authored
Merge pull request #78 from rfsbraz/77-typeerror-nonetype-object-is-not-iterable-since-v0013
fix: Fix crashing when disk size wasn't set
2 parents 567c1f0 + 37dc200 commit aa3b2fe

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

.github/workflows/docker-image-dockerhub.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
- 'develop'
99
tags:
1010
- 'v*'
11+
pull_request:
12+
branches:
13+
- 'develop'
1114

1215
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
1316
env:
@@ -73,7 +76,7 @@ jobs:
7376
uses: docker/build-push-action@v3
7477
with:
7578
context: .
76-
push: true
79+
push: ${{ github.event_name != 'pull_request' }}
7780
tags: ${{ steps.meta.outputs.tags }}
7881
labels: ${{ steps.meta.outputs.labels }}
7982
build-args: |

app/deleterr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ def get_file_contents(file_path):
694694

695695

696696
def library_meets_disk_space_threshold(library, pyarr):
697-
for item in library.get("disk_size_threshold"):
697+
for item in library.get("disk_size_threshold", []):
698698
path = item.get("path")
699699
threshold = item.get("threshold")
700700
disk_space = pyarr.get_disk_space()
@@ -716,7 +716,7 @@ def library_meets_disk_space_threshold(library, pyarr):
716716
f"Could not find folder '{path}' in server instance. Skipping library '{library.get('name')}'"
717717
)
718718
return False
719-
return True
719+
return True
720720

721721

722722
def main():

tests/test_deleterr.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ def test_folder_not_found(self):
2929
]
3030
self.assertFalse(library_meets_disk_space_threshold(self.library, self.pyarr))
3131

32+
def test_unset_disk_size_threshold(self):
33+
del self.library["disk_size_threshold"]
34+
self.assertTrue(library_meets_disk_space_threshold(self.library, self.pyarr))
35+
3236

3337
class TestFindWatchedData(unittest.TestCase):
3438
def setUp(self):

0 commit comments

Comments
 (0)