Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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)
Ejemplo n.º 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))
Ejemplo n.º 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'