예제 #1
0
파일: client.py 프로젝트: liveck/HyperDex
def validate_space(args):
    data = sys.stdin.read()
    try:
        parser = (hdcoordinator.parser.space + pyparsing.stringEnd)
        space = parser.parseString(data)[0]
    except pyparsing.ParseException as e:
        print str(e)
        return 1
    return 0
예제 #2
0
파일: client.py 프로젝트: liveck/HyperDex
def add_space(args):
    data = sys.stdin.read()
    try:
        parser = (hdcoordinator.parser.space + pyparsing.stringEnd)
        space = parser.parseString(data)[0]
    except pyparsing.ParseException as e:
        print str(e)
        return 1
    text = 'add space\n{0}\n.\n'.format(data)
    return send_text(args.host, args.port, text)
예제 #3
0
 def add_space(self, data):
     try:
         parser = (hdcoordinator.parser.space + pyparsing.stringEnd)
         space = parser.parseString(data)[0]
         self._coordinator.add_space(space)
     except ValueError as e:
         return self._fail(str(e))
     except pyparsing.ParseException as e:
         return self._fail(str(e))
     except Coordinator.DuplicateSpace as e:
         return self._fail("Space already exists")
     self.outgoing += 'SUCCESS\n'
     logging.info("created new space \"{0}\"".format(space.name))
예제 #4
0
 def add_space(self, data):
     try:
         parser = (hdcoordinator.parser.space + pyparsing.stringEnd)
         space = parser.parseString(data)[0]
         self._coordinator.add_space(space)
     except ValueError as e:
         return self._fail(str(e))
     except pyparsing.ParseException as e:
         return self._fail(str(e))
     except Coordinator.DuplicateSpace as e:
         return self._fail("Space already exists")
     self._reconfigure_all()
     self.outgoing += 'SUCCESS\n'