mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Refactore unused code
This commit is contained in:
parent
dddd4b2522
commit
e02cf2aab7
1 changed files with 0 additions and 29 deletions
|
@ -111,37 +111,8 @@ except ImportError, e:
|
||||||
print "failed=True msg='failed to import python module: %s'" % e
|
print "failed=True msg='failed to import python module: %s'" % e
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def _human_to_bytes(number):
|
|
||||||
suffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']
|
|
||||||
|
|
||||||
if isinstance(number, int):
|
|
||||||
return number
|
|
||||||
if number[-1] == suffixes[0] and number[-2].isdigit():
|
|
||||||
return number[:-1]
|
|
||||||
|
|
||||||
i = 1
|
|
||||||
for each in suffixes[1:]:
|
|
||||||
if number[-len(each):] == suffixes[i]:
|
|
||||||
return int(number[:-len(each)]) * (1024 ** i)
|
|
||||||
i = i + 1
|
|
||||||
|
|
||||||
print "failed=True msg='Could not convert %s to integer'" % (number)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
def _ansible_facts(container_list):
|
|
||||||
return {"docker_containers": container_list}
|
|
||||||
|
|
||||||
def _docker_id_quirk(inspect):
|
|
||||||
# XXX: some quirk in docker
|
|
||||||
if 'ID' in inspect:
|
|
||||||
inspect['Id'] = inspect['ID']
|
|
||||||
del inspect['ID']
|
|
||||||
return inspect
|
|
||||||
|
|
||||||
class DockerImageManager:
|
class DockerImageManager:
|
||||||
|
|
||||||
counters = {'created':0, 'started':0, 'stopped':0, 'killed':0, 'removed':0, 'restarted':0, 'pull':0}
|
|
||||||
|
|
||||||
def __init__(self, module):
|
def __init__(self, module):
|
||||||
self.module = module
|
self.module = module
|
||||||
self.path = self.module.params.get('path')
|
self.path = self.module.params.get('path')
|
||||||
|
|
Loading…
Reference in a new issue