Re: Running into some strange issues.

Dirk H Bartley <[email protected]> Thu, 17 Dec 2009 15:47:12 -0500
Newsgroups gmane.comp.cms.opengroupware.xmlrpc.devel
Message-ID <[email protected]>
Ok, I figured it out.  I have to add


rm -Rf /var/lib/opengroupware.org/documents/*

to the start over script.

Any other directories I should empty??

Dirk

On Thu, 2009-12-17 at 13:11 -0500, Dirk H Bartley wrote:
> Greetings
> 
> Hopefully someone can assist with some strange issue I have here.
> 
> So I'm using some python scripts to import data into ogo.  I am having
> issues with my second script.
> 
> The effort here is to be able to start from a blank fresh database.
> 
> So I stop and start ogo like so:
> 
> #!/bin/bash
> /etc/init.d/opengroupware stop
> /etc/init.d/ogo-zidestore stop
> /etc/init.d/ogo-xmlrpcd stop
> 
> setfacl -R -m u:postgres:rwx /bacula-restores/root
> su -l postgres -c '/var/lib/pgsql/redoOGo'
> 
> /etc/init.d/opengroupware start
> /etc/init.d/ogo-zidestore start
> /etc/init.d/ogo-xmlrpcd start
> 
> where '/var/lib/pgsql/redoOGo' is
> #!/bin/bash
> dropdb OGo
> createdb -E UTF-8 -O OGo OGo
> #pg_restore --verbose --format=t
> --dbname=OGo /bacula-restores/root/database/OGo.pg_dump
> #psql -U OGo OGo < pg-build-schema.psql
> psql -U OGo OGo
> < /home/SCHUPAN/dbartley/src/opengroupware/Database/PostgreSQL/pg-build-schema.psql
> #psql -U OGo OGo
> < /home/SCHUPAN/dbartley/src/opengroupware/Database/PostgreSQL/pg-build-schema.psql.constraints
> psql -U OGo OGo
> < /home/SCHUPAN/dbartley/src/opengroupware/Database/PostgreSQL/pg-update-1.x-to-5.5.psql
> psql -U OGo OGo
> < /home/SCHUPAN/dbartley/src/opengroupware/Database/PostgreSQL/pg-fill-objinfo.psql
> psql -U OGo OGo
> < /home/SCHUPAN/dbartley/src/opengroupware/Database/PostgreSQL/pg-update-schema.psql
> 
> So after this I log in as the upsuser in the web based interface just to
> get the user added.  Going to the web interface does not automatically
> connect as root as I would have expected from wmogag.
> 
> then I am able to run one of the python import scripts successfully.  It
> imports data from our erp.
> 
> The second one gives me errors, but not till about the 5th or so record.
> Then pukes with:
> 
> <begin>
> Creating new enterprise in impgold.py importcust
> {'_COMPANYVALUES': [{'attribute': 'bai_id', 'value': '0ALCTU'},
> {'attribute': 'salesman', 'value': 'MASTER'}], '_PHONES': [{'info':
> 'import-12-17-09', 'type': '01_tel', 'number': '(313)537-7510'},
> {'info': 'import-12-17-09', 'type': '10_fax', 'number':
> '(313)537-9017'}], 'name': 'ALCO TURNING CO., INC.', 'objectId': 0,
> 'entityName': 'Enterprise', '_ADDRESSES': [{'city': 'REDFORD', 'zip':
> '48240', 'state': 'MI', 'street': '25610 W 7 MILE ROAD', 'name3': '',
> 'name1': 'ALCO TURNING CO., INC.', 'type': 'ship'}, {'city': 'REDFORD',
> 'zip': '48240', 'state': 'MI', 'street': '25610 W 7 MILE ROAD', 'name3':
> '', 'name1': 'ALCO TURNING CO., INC.', 'type': 'bill'}], 'keywords':
> 'SAS Customers'}
> Traceback (most recent call last):
>   File "./importgoldcontact1", line 78, in ?
>     ogoid = impgold.importcust(server, arr)
>   File "/home/SCHUPAN/dbartley/ogoimport/impgold.py", line 82, in
> importcust
>     enterprise = server.zogi.putObject(object)
>   File "/usr/lib64/python2.4/xmlrpclib.py", line 1096, in __call__
>     return self.__send(self.__name, args)
>   File "/usr/lib64/python2.4/xmlrpclib.py", line 1383, in __request
>     verbose=self.__verbose
>   File "/usr/lib64/python2.4/xmlrpclib.py", line 1147, in request
>     return self._parse_response(h.getfile(), sock)
>   File "/usr/lib64/python2.4/xmlrpclib.py", line 1286, in
> _parse_response
>     return u.close()
>   File "/usr/lib64/python2.4/xmlrpclib.py", line 744, in close
>     raise Fault(**self._stack[0])
> xmlrpclib.Fault: <Fault 0: 'AssertException: error during save of
> attachment to  or  {\n    methodName = "zogi.putObject";\n
> methodParameters = (\n        {\n            "_ADDRESSES" = (\n
> {\n                    city = REDFORD;\n                    name1 =
> "ALCO TURNING CO., INC.";\n                    name3 = "";\n
> state = MI;\n                    street = "25610 W 7 MILE ROAD";\n
> type = ship;\n                    zip = 48240;\n                },\n
> {\n                    city = REDFORD;\n                    name1 =
> "ALCO TURNING CO., INC.";\n                    name3 = "";\n
> state = MI;\n                    street = "25610 W 7 MILE ROAD";\n
> type = bill;\n                    zip = 48240;
> \n                }\n            );\n            "_COMPANYVALUES" = (\n
> {\n                    attribute = "bai_id";\n                    value
> = 0ALCTU;\n                },\n                {\n
> attribute = salesman;\n                    value = MASTER;
> \n                }\n            );\n            "_PHONES" = (\n
> {\n                    info = "import-12-17-09";\n
> number = "(313)537-7510";\n                    type = "01_tel";
> \n                },\n                {\n                    info =
> "import-12-17-09";\n                    number = "(313)537-9017";\n
> type = "10_fax";\n                }\n            );\n
> entityName = Enterprise;\n            keywords = "SAS Customers";\n
> name = "ALCO TURNING CO., INC.";\n            objectId = 0;
> \n        }\n    );\n}'>
> <end>
> 
> So I'm confused.  I can take the object and make a very simple program
> and get the errors.
> 
> #!/usr/bin/env python
> 
> import sys, csv, xmlrpclib, time, pg, imppost
> from time import strftime
> 
> server =
> xmlrpclib.Server('http://upsuser:brown@mta1/zidestore/so/upsuser')
> 
> object = {'_COMPANYVALUES': [{'attribute': 'bai_id', 'value': '0BURPO'},
> {'attribute': 'salesman', 'value': 'MASTER'}], '_PHONES': [{'info':
> 'import-12-17-09', 'type': '01_tel', 'number': '(616)459-9531'},
> {'info': 'import-12-17-09', 'type': '10_fax', 'number':
> '(616)459-1032'}], 'name': 'BURKE E. PORTER', 'objectId': 0,
> 'entityName': 'Enterprise', '_ADDRESSES': [{'city': 'GRAND RAPIDS',
> 'zip': '495O5', 'state': 'MI', 'street': '73O PLYMOUTH ROAD, N. E.',
> 'name3': '', 'name1': 'BURKE E. PORTER', 'type': 'ship'}, {'city':
> 'GRAND RAPIDS', 'zip': '495O5', 'state': 'MI', 'street': '73O PLYMOUTH
> ROAD, N. E.', 'name3': '', 'name1': 'BURKE E. PORTER', 'type': 'bill'}],
> 'keywords': 'SAS Customers'}
> 
> print object
> enterprise = server.zogi.putObject(object)
> print 'Created Enterprise # %d' % enterprise['objectId']
> 
> 
> 
> 
> But the errors are not consistent right away.  The more I enter, the
> more likely.
> 
> It seems to me that I am not getting the database re-established or
> there is something else I need to do before importing, but I'm not sure
> what it is.
> 
> All assistance is appreciated.  Thanks in advance.
> 
> Dirk
> 

-- 
OpenGroupware.org XML-RPC
[email protected]
http://mail.opengroupware.org/mailman/listinfo/xmlrpc