Closed bodi000 closed 2 years ago
It appears that the problem comes from ssh keys [not] available to odoo user which runs odoo.
@ecino any idea on this?
Hi @bodi000, please verify that you configured correctly your users in the Accounting->Configuration->FDS Postfinance Acccount menu. You should add the ssh public key your are using for each user that will connect to FDS. See the attached screenshot:
Hello and thank you @ecino for your answer. As I mentioned, everything works fine in the pydev debugger (local user) but not directly (dedicated user). It also works (i can connect to fds) in external applications, e.g. fileZilla, so I think that there is some issue with ssh configuration for the openerp dedicated system user. I tried to configure /etc/ssh/ssh_config to use a specific private key, maybe something is missing...
Added:
Host fdsbc.post.ch
HostName fdsbc.post.ch
HashKnownHosts yes
IdentityFile /etc/ssh/asio_id_rsa
before Host *
Thank you in advance
Hi @bodi000 I think I had this issue. One way to solve that is to connect to fds:
ssh openerp@fdsbc.post.ch
from the terminal with the dedicated user. The purpose is not to log in, but rather accept the host key (as it's the first time you connect)
Hello and thank you @ecino for your answer. As I mentioned, everything works fine in the pydev debugger (local user) but not directly (dedicated user). It also works (i can connect to fds) in external applications, e.g. fileZilla, so I think that there is some issue with ssh configuration for the openerp dedicated system user. I tried to configure /etc/ssh/ssh_config to use a specific private key, maybe something is missing...
Added:
Host fdsbc.post.ch
HostName fdsbc.post.ch
HashKnownHosts yes
IdentityFile /etc/ssh/asio_id_rsa
before Host *
Thank you in advance
While running python /opt/openerp/9.0/openerp-server -c /etc/odoo90.conf
everything works as expected with my user. However, if I run with the dedicated user (openerp), I get the following traceback on FDS import:
Traceback (most recent call last):
File "/opt/openerp/9.0/extra-addons/dirs/l10n-switzerland-9.0/l10n_ch_fds_postfinance/wizards/fds_files_import_tobankstatments_wizard.py", line 107, in import_button
private_key_pass=key_pass) as sftp:
File "/usr/local/lib/python2.7/dist-packages/pysftp/__init__.py", line 132, in __init__
self._tconnect['hostkey'] = self._cnopts.get_hostkey(host)
File "/usr/local/lib/python2.7/dist-packages/pysftp/__init__.py", line 71, in get_hostkey
raise SSHException("No hostkey for host %s found." % host)
SSHException: No hostkey for host fdsbc.post.ch found.
Exception AttributeError: "'Connection' object has no attribute '_sftp_live'" in <bound method Connection.__del__ of <pysftp.Connection object at 0x7f65bfc70390>> ignored
SOLVED!!
But with a workaround, not sure what is the best way to deal with this. Situation: Using a system user with no HOME. Therefore no ~/.ssh/known_hosts file. Configuring a global known_hosts (/etc/ssh/ssh_known_hosts) does not solve the issue, as it does not get checked. Adding the following code DOES solve the problem, but I think this should be solved at pysftp level.
cnopts = pysftp.CnOpts(knownhosts='/etc/ssh/ssh_known_hosts')
cnopts.hostkeys = None
# connect sftp
with pysftp.Connection(
self.hostname, username=self.username,
private_key=tmp_key.name, private_key_pass=key_pass, cnopts=cnopts
) as sftp:
another elegant way would be to add a config parameter for the known_hosts file so it is not hard-coded. Any suggestion welcomed :grinning:
I think the best solution would be to include the public key into the package. Makes it work out of the box.
I had several issues connecting to fdsbc.post.ch as well. What worked for me was to
Hope this helps someone.
So I have been trying to get the CAMT PostFinance import working from within Odoo11 (actually Flectra). Here I'm having an issue which I think has something to do with new Python 3 coding conventions for lists. Has anyone else had this issue or can offer a solution???
File "/home/ODOO_DIR/odoo-local/addons/1.7/muk_account_bank_statement_import_sheet/wizards/account_bank_statement_import.py", line 72, in import_file
return super(AccountBankStatementImport, self).import_file()
File "/home/ODOO_DIR/odoo/addons/account_bank_statement_import/account_bank_statement_import.py", line 51, in import_file
statement_ids, notifications = self._create_bank_statements(stmts_vals)
File "/home/ODOO_DIR/local-addons/l10n_ch_bank_statement_import_postfinance/wizards/account_bank_statement_import_postfinance.py", line 19, in _create_bank_statements
attachments = list(stmt_vals[0].pop('attachments', list()))
TypeError: 'odict_values' object does not support indexing
I'm also getting errors as follows:
File "/home/ODOO_DIR/odoo-local/addons/1.7/l10n_ch_fds_postfinance/models/fds_postfinance_file.py", line 64, in import_button
valid_files.import2bankStatements()
File "/home/ODOO_DIR/odoo-local/addons/1.7/l10n_ch_fds_postfinance/models/fds_postfinance_file.py", line 131, in import2bankStatements
'error_message': e.name or e.args and e.args[0]
AttributeError: 'TypeError' object has no attribute 'name'
Help?!?
So I have been trying to get the CAMT PostFinance import working from within Odoo11 (actually Flectra). Here I'm having an issue which I think has something to do with new Python 3 coding conventions for lists. Has anyone else had this issue or can offer a solution???
File "/home/ODOO_DIR/odoo-local/addons/1.7/muk_account_bank_statement_import_sheet/wizards/account_bank_statement_import.py", line 72, in import_file return super(AccountBankStatementImport, self).import_file() File "/home/ODOO_DIR/odoo/addons/account_bank_statement_import/account_bank_statement_import.py", line 51, in import_file statement_ids, notifications = self._create_bank_statements(stmts_vals) File "/home/ODOO_DIR/local-addons/l10n_ch_bank_statement_import_postfinance/wizards/account_bank_statement_import_postfinance.py", line 19, in _create_bank_statements attachments = list(stmt_vals[0].pop('attachments', list())) TypeError: 'odict_values' object does not support indexing
I'm also getting errors as follows:
File "/home/ODOO_DIR/odoo-local/addons/1.7/l10n_ch_fds_postfinance/models/fds_postfinance_file.py", line 64, in import_button valid_files.import2bankStatements() File "/home/ODOO_DIR/odoo-local/addons/1.7/l10n_ch_fds_postfinance/models/fds_postfinance_file.py", line 131, in import2bankStatements 'error_message': e.name or e.args and e.args[0] AttributeError: 'TypeError' object has no attribute 'name'
Help?!?
Hi again. I never did manage to resolve this. Anyone????? ( Potential consulting gig available to fix)
Hi. I was wondering, is there any work going on to port l10n_ch_bank_statement_import_postfinance module to Odoo 14 Community Edition?
There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.
Hello,
I installed the module and configured an existing fds account. I can connect to it via ssh in ubuntu. The keys are valid. I added the public key to the known_hosts file.
in the log I get the following message:
2018-02-19 10:40:02,686 1627 ERROR bs_06_v8_migrated openerp.addons.l10n_ch_fds_postfinance.wizards.fds_files_import_tobankstatments_wizard: None
2018-02-19 10:41:17,450 1627 ERROR bs_06_v8_migrated openerp.addons.l10n_ch_fds_postfinance.models.fds_postfinance_account: Unable to connect to the sftp: No hostkey for host fdsbc.post.ch found.
Surprisingly, while running through eclipse debug (same config file), I was able to connect and download the files from FDS, so I could not find the error.
Any help is welcome! Thank you b