Subversion Repositories SmartDukaan

Rev

Rev 3915 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3915 Rev 4651
Line 23... Line 23...
23
    
23
    
24
    def __init__(self, logfile='/var/log/services/catalog.log', pidfile='/tmp/catalog-server.pid'):
24
    def __init__(self, logfile='/var/log/services/catalog.log', pidfile='/tmp/catalog-server.pid'):
25
        Daemon.__init__(self, pidfile, stdout=logfile, stderr=logfile)
25
        Daemon.__init__(self, pidfile, stdout=logfile, stderr=logfile)
26
 
26
 
27
    def run(self):
27
    def run(self):
28
        #get the config client
-
 
29
        try:
28
 
30
            config_client = ConfigClient()
29
        config_client = ConfigClient()
31
            host_name = config_client.get_property('catalog_service_server_host')
30
        host_name = config_client.get_property('catalog_service_server_host')
32
            port = config_client.get_property('catalog_service_server_port')
31
        port = config_client.get_property('catalog_service_server_port')
33
            dbname = config_client.get_property('catalog_service_dbname')
32
        dbname = config_client.get_property('catalog_service_dbname')
34
            db_hostname = config_client.get_property('catalog_service_db_hostname')
33
        db_hostname = config_client.get_property('catalog_service_db_hostname')
35
        except:
-
 
36
            #error while spawning the config server
-
 
37
            host_name = 'localhost'
-
 
38
            port = 9001
-
 
39
            dbname = 'catalog'
-
 
40
            db_hostname='localhost'
-
 
41
        
34
        
42
        handler = InventoryServiceHandler(dbname, db_hostname)
35
        handler = InventoryServiceHandler(dbname, db_hostname)
43
        processor = InventoryService.Processor(handler)
36
        processor = InventoryService.Processor(handler)
44
        transport = TSocket.TServerSocket(port=port)
37
        transport = TSocket.TServerSocket(port=port)
45
        tfactory = TTransport.TFramedTransportFactory()
38
        tfactory = TTransport.TFramedTransportFactory()