예제 #1
0
 def __call__(self, name, **data):
     h = Host.create(name, data)
     if not h:
         raise DoesNotExistsException("Cannot create host {0}"
                                      .format(name))
     returner = host_show(cli_mode=self.cli_mode)
     return returner(name)
예제 #2
0
 def __call__(self, name, key, *args, **kwargs):
     h = Host.find(name)
     if not h:
         raise DoesNotExistsException("Host {0} does not exists in database"
                                      .format(name))
     h.add(key, *args, **kwargs)
     if self.cli_mode:
         print("Host {0} updated at {1}".format(name, key))
예제 #3
0
 def __call__(self, name):
     h = Host.find(name)
     if not h:
         raise DoesNotExistsException("Host {0} does not exists in database"
                                      .format(name))
     h.delete()
     if self.cli_mode:
         print("Host {0} deleted".format(name))
예제 #4
0
 def __call__(self, **filters):
     if self.cli_mode:
         print(title("Hosts:"))
     hosts = [h.name for h in Host.filter(**filters)]
     if self.cli_mode:
         for h in hosts:
             print(" - {0}".format(h))
     return hosts
예제 #5
0
 def __call__(self, name, key):
     h = Host.find(name)
     if not h:
         raise DoesNotExistsException("Host {0} does not exists in database"
                                      .format(name))
     h.remove(key)
     if self.cli_mode:
         print("Host {0} updated (removed {1})".format(name, key))
예제 #6
0
파일: host.py 프로젝트: ponkt/pepperstack
 def __call__(self, name):
     h = Host.find(name)
     if not h:
         raise DoesNotExistsException(
             "Host {0} does not exists in database".format(name))
     h.delete()
     if self.cli_mode:
         print("Host {0} deleted".format(name))
예제 #7
0
파일: host.py 프로젝트: ponkt/pepperstack
 def __call__(self, name, key, *args, **kwargs):
     h = Host.find(name)
     if not h:
         raise DoesNotExistsException(
             "Host {0} does not exists in database".format(name))
     h.add(key, *args, **kwargs)
     if self.cli_mode:
         print("Host {0} updated at {1}".format(name, key))
예제 #8
0
파일: host.py 프로젝트: ponkt/pepperstack
 def __call__(self, **filters):
     if self.cli_mode:
         print(title("Hosts:"))
     hosts = [h.name for h in Host.filter(**filters)]
     if self.cli_mode:
         for h in hosts:
             print(" - {0}".format(h))
     return hosts
예제 #9
0
파일: host.py 프로젝트: ponkt/pepperstack
 def __call__(self, name, key):
     h = Host.find(name)
     if not h:
         raise DoesNotExistsException(
             "Host {0} does not exists in database".format(name))
     h.remove(key)
     if self.cli_mode:
         print("Host {0} updated (removed {1})".format(name, key))
예제 #10
0
 def __call__(self, name):
     h = Host.find(name)
     if not h:
         raise DoesNotExistsException("Host {0} does not exists in database"
                                      .format(name))
     ret = h.as_dict()
     if self.cli_mode:
         print(title(h.name + ':'))
         pretty_print(ret)
     return ret
예제 #11
0
 def __call__(self, name, key, default=None):
     h = Host.find(name)
     if not h:
         raise DoesNotExistsException("Host {0} does not exists in database"
                                      .format(name))
     ret = h.get(key, default)
     if self.cli_mode:
         print(title(h.name + ':'))
         print("{0}: {1}".format(key, ret))
     return ret
예제 #12
0
파일: host.py 프로젝트: ponkt/pepperstack
 def __call__(self, name):
     h = Host.find(name)
     if not h:
         raise DoesNotExistsException(
             "Host {0} does not exists in database".format(name))
     ret = h.as_dict()
     if self.cli_mode:
         print(title(h.name + ':'))
         pretty_print(ret)
     return ret
예제 #13
0
파일: host.py 프로젝트: ponkt/pepperstack
 def __call__(self, name, key, default=None):
     h = Host.find(name)
     if not h:
         raise DoesNotExistsException(
             "Host {0} does not exists in database".format(name))
     ret = h.get(key, default)
     if self.cli_mode:
         print(title(h.name + ':'))
         print("{0}: {1}".format(key, ret))
     return ret
예제 #14
0
파일: host.py 프로젝트: ponkt/pepperstack
 def __call__(self, name, **data):
     h = Host.create(name, data)
     if not h:
         raise DoesNotExistsException("Cannot create host {0}".format(name))
     returner = host_show(cli_mode=self.cli_mode)
     return returner(name)