Formatting Question - RepoList
NFerrovia opened this issue · comments
Hello! Thank you for your hard work on this tool!
I have a question regarding RepoList, i can't seem to get it to work unlike the normal Repo & Name rule.
The instructions read as follow:
- rule: RepoList
repos:
- repo1
- repo2
- repo3
my code reads as follows:
- rule: RepoList
repos:
- repo1
- repo2
- rule: DeleteEmptyFolders
And i am getting the following error:
'NoneType' object has no attribute 'get'
Could you get a full yaml configuration and the full traceback? You can remove your private data there
Sure, here's also the code running as intended on the normal repo & name config.
artifactory-cleanup:
server: $ARTIFACTORY_SERVER
user: $ARTIFACTORY_USERNAME
password: $ARTIFACTORY_PASSWORD
policies:
- name: Remove all empty folders from repo1
rules:
- rule: Repo
name: "repo1"
- rule: DeleteEmptyFolders
Which works as intended as seen here:
+----------------------------------------------------+-------------+------+
| Cleanup Policy | Files count | Size |
+----------------------------------------------------+-------------+------+
| Remove all empty folders from ba-core-docker-local | 16474 | 299G |
| | | |
| Total size: 299G | | |
+----------------------------------------------------+-------------+------+
But when i utilize Repolist:
artifactory-cleanup:
server: $ARTIFACTORY_SERVER
user: $ARTIFACTORY_USERNAME
password: $ARTIFACTORY_PASSWORD
policies:
- name: Delete empty folders from [repo1, repo2, repo3]
rules:
- rule: RepoList
repos:
- repo1
- repo2
- repo3
- rule: DeleteEmptyFolders
I get the aforementioned unceremonious error no traceback:
$ artifactory-cleanup
********************************************************************************
Verbose MODE
Checking 'repo1' repository exists.
Check failed for rule 'RepoList' in policy 'Delete empty folders from [repo1, repo2, repo3]':
'NoneType' object has no attribute 'get'
Which leads me to believe i have a formatting error, but this is what i gathered from the instructions.
I've tried different configurations but since i can't find a proper example on repoList i thought i'd open this issue with this question.
Just for clarification i replaced the repos with just placeholder names here but when i run the normal configuration above it has no problems finding the repos, i also tried the repos with or without quotes to the same result, not sure if that matters tho.
My artifactory-cleanup i believe is up to date:
$ artifactory-cleanup --version
artifactory-cleanup 1.0.3
I get this too; RepoList is broken. If I remove the exception catching to get a full traceback it looks like:
Checking 'pypi-master' repository exists.
Traceback (most recent call last):
File "/usr/local/bin/artifactory-cleanup", line 8, in <module>
sys.exit(ArtifactoryCleanupCLI())
File "/usr/local/lib/python3.8/site-packages/plumbum/cli/application.py", line 177, in __new__
return cls.run()
File "/usr/local/lib/python3.8/site-packages/plumbum/cli/application.py", line 634, in run
retcode = inst.main(*tailargs)
File "/usr/local/lib/python3.8/site-packages/artifactory_cleanup/cli.py", line 121, in main
for summary in cleanup.cleanup(
File "/usr/local/lib/python3.8/site-packages/artifactory_cleanup/artifactorycleanup.py", line 41, in cleanup
policy.check()
File "/usr/local/lib/python3.8/site-packages/artifactory_cleanup/rules/base.py", line 192, in check
rule.check(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/artifactory_cleanup/rules/repo.py", line 52, in check
repo.check(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/artifactory_cleanup/rules/repo.py", line 28, in check
r = self.session.get(url)
AttributeError: 'NoneType' object has no attribute 'get'
Perhaps the BaseUrlSession object hasn't been initialised?
Everything works great for this repo on its own using just Repo
.
Hello! Any news on this issue?
That's great! Thank you for your hard work.