Browse Source

9.0 migration of server_environment

pull/337/head
Alexandre Fayolle 9 years ago
committed by Alexandre Fayolle
parent
commit
b324ab94cb
  1. 6
      .travis.yml
  2. 125
      server_environment/README.rst
  3. 59
      server_environment/__openerp__.py
  4. 2
      server_environment/serv_config.xml
  5. 75
      server_environment_files_sample/README.rst
  6. 21
      server_environment_files_sample/__openerp__.py

6
.travis.yml

@ -22,7 +22,7 @@ env:
- TRANSIFEX="1" - TRANSIFEX="1"
- TESTS="1" ODOO_REPO="odoo/odoo" - TESTS="1" ODOO_REPO="odoo/odoo"
- TESTS="1" ODOO_REPO="OCA/OCB" - TESTS="1" ODOO_REPO="OCA/OCB"
- UNIT_TEST="1"
- UNIT_TEST="1"
virtualenv: virtualenv:
system_site_packages: true system_site_packages: true
@ -31,8 +31,8 @@ install:
- git clone https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools - git clone https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH} - export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- travis_install_nightly - travis_install_nightly
- printf '[options]\n\nrunning_env = dev' > ${HOME}/.openerp_serverrc
- ln -s server_environment_files_sample ./server_environment_files
- printf '[options]\n\nrunning_env = dev\n' > ${HOME}/.openerp_serverrc
- ln -s ${TRAVIS_BUILD_DIR}/server_environment_files_sample ${TRAVIS_BUILD_DIR}/server_environment_files
script: script:
- travis_run_tests - travis_run_tests

125
server_environment/README.rst

@ -0,0 +1,125 @@
.. image:: https://img.shields.io/badge/licence-GPL--3-blue.svg
:target: http://www.gnu.org/licenses/gpl-3.0-standalone.html
:alt: License: GPL-3
==================
server environment
==================
This module provides a way to define an environment in the main Odoo
configuration file and to read some configurations from files
depending on the configured environment: you define the environment in
the main configuration file, and the values for the various possible
environments are stored in the `server_environment_files` companion
module.
All the settings will be read only and visible under the Configuration
menu. If you are not in the 'dev' environment you will not be able to
see the values contained in keys named '*passw*'.
Installation
============
By itself, this module does little. See for instance the
`mail_environment` addon which depends on this one to allow configuring
the incoming and outgoing mail servers depending on the environment.
To install this module, you need to provide a companion module called
`server_environment_files`. You can copy and customize the provided
`server_environment_files_sample` module for this purpose.
Configuration
=============
To configure this module, you need to edit the main configuration file
of your instance, and add a directive called `running_env`. Commonly
used values are 'dev', 'test', 'production'::
[options]
running_env=dev
You should then edit the settings you need in the
`server_environment_files` addon. The
`server_environment_files_sample` can be used as an example:
* values common to all / most environments can be stored in the
`default/` directory using the .ini file syntax
* each environment you need to define is stored in its own directory
and can override or extend default values. Values associated to keys
containing 'passw' are only displayed in the 'dev' environment.
Usage
=====
To use this module, in your code, you can follow this example::
from openerp.addons.server_environment import serv_config
for key, value in serv_config.items('external_service.ftp'):
print (key, value)
serv_config.get('external_service.ftp', 'tls')
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/9.0
Known issues / Roadmap
======================
* it is not possible to set the environment from the command line. A
configuration file must be used.
* the module does not allow to set low level attributes such as database server, etc.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed `feedback
<https://github.com/OCA/
server-tools/issues/new?body=module:%20
server_environment%0Aversion:%20
9.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Alexandre Fayolle <alexandre.fayolle@camptocamp.com>
* Daniel Reis <dgreis@sapo.pt>
* Florent Xicluna <florent.xicluna@gmail.com>
* Guewen Baconnier <guewen.baconnier@camptocamp.com>
* Holger Brunn <hbrunn@therp.nl>
* Joël Grand-Guillaume <joel.grandguillaume@camptocamp.com>
* Nicolas Bessi <nicolas.bessi@camptocamp.com>
* Wingo
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

59
server_environment/__openerp__.py

@ -21,67 +21,16 @@
{ {
"name": "server configuration environment files", "name": "server configuration environment files",
"version": "8.0.1.1.0",
"version": "9.0.1.1.0",
"depends": ["base", "server_environment_files"], "depends": ["base", "server_environment_files"],
"author": "Camptocamp,Odoo Community Association (OCA)", "author": "Camptocamp,Odoo Community Association (OCA)",
"description": """\
Environment file pattern for OpenERP
====================================
This module provides a classical configuration by environnement file
pattern into OpenERP. Based on code written by WinGo and Camptocamp.
This module allows you to use the classical environment file pattern
by reading a directive call `running_env` in the OpenERP configuration
file::
[options]
running_env=dev / prod / etc.
We intended to add a server command line but there is no correct way
to do it.
This method allows you to keep your settings into a module instead of
using config files that might be mixed with openerprc or altered. It
is an alternative way to the base config file for such configuration
needs . All your configurations will be read only and accessible
under the admin menu. If you are not in the 'dev' environment you
will not be able to see the values contained in keys named 'passw'.
At the current time, the module does not allow to set low level
attributes such as database server, etc. .
The first goal of the module is to ensure that OpenERP will never mess
up the external system. Once installed, profile is mandatory. We do
not want to launch an instance in the dev environment on a production
server.
The configuration files are stored in the `server_environment_files`
module, and user config parser module syntax. Look at the module to
get some examples. The `default` configuration are stored in the
`default/` directory. You can add one directory for each environment
you want to define, named after the environment. All config defined in
non-default environments will override or complement the default
config. If your attibutes contain `passw`, it will only be shown in
the `dev` environment.
Example usage
-------------
::
from server_environment import serv_config
for key, value in serv_config.items('external_service.ftp'):
print (key, value)
serv_config.get('external_service.ftp', 'tls')
""",
"website": "http://www.camptocamp.com",
"summary": "move some configurations out of the database",
"website": "http://odoo-community.org/",
"license": "GPL-3 or any later version", "license": "GPL-3 or any later version",
"category": "Tools", "category": "Tools",
"data": [ "data": [
'serv_config.xml', 'serv_config.xml',
], ],
'installable': False,
'installable': True,
"active": False, "active": False,
} }

2
server_environment/serv_config.xml

@ -9,7 +9,7 @@
view_mode="form"/> view_mode="form"/>
<menuitem <menuitem
parent="base.menu_config"
parent="base.menu_ir_property"
icon="STOCK_PROPERTIES" icon="STOCK_PROPERTIES"
sequence="90" sequence="90"
action="act_show_config_window" action="act_show_config_window"

75
server_environment_files_sample/README.rst

@ -0,0 +1,75 @@
.. image:: https://img.shields.io/badge/licence-GPL--3-blue.svg
:target: http://www.gnu.org/licenses/gpl-3.0-standalone.html
:alt: License: GPL-3
=================================
server environment files (sample)
=================================
This is an example module to be used for
`server_environment_files`. Check that module's README for more
information.
Installation
============
Do not install this module as is. Copy it to a directory in your
addons-path and rename it to
`server_environment_files`, then edit the various configurations.
Usage
=====
This module is not testable on runbot (see above).
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed `feedback
<https://github.com/OCA/
server-tools/issues/new?body=module:%20
server_environment%0Aversion:%20
9.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Alexandre Fayolle <alexandre.fayolle@camptocamp.com>
* Daniel Reis <dgreis@sapo.pt>
* Florent Xicluna <florent.xicluna@gmail.com>
* Guewen Baconnier <guewen.baconnier@camptocamp.com>
* Holger Brunn <hbrunn@therp.nl>
* Joël Grand-Guillaume <joel.grandguillaume@camptocamp.com>
* Nicolas Bessi <nicolas.bessi@camptocamp.com>
* Wingo
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

21
server_environment_files_sample/__openerp__.py

@ -21,29 +21,14 @@
{ {
"name": "Example server configuration environment files repository module", "name": "Example server configuration environment files repository module",
"version": "8.0.1.0.0",
"version": "9.0.1.0.0",
"depends": ["base"], "depends": ["base"],
"author": "Camptocamp,Odoo Community Association (OCA)", "author": "Camptocamp,Odoo Community Association (OCA)",
"description": """\
File store for environment file sample module
=============================================
This module provides a file store for classical configuration by
environment file pattern into OpenERP provided by the
`server_environment` addon. Please look at this module for more info
and doc.
Note: you should not install this module 'as is', since it is an
example module, but rather adapt it to your needs, and ensure your
version of the module gets picked up by OpenERP. This can be ensured
by putting the directory where your version of
server_environment_files lives before this one in the addons-path
variable of the OpenERP configuration file.
""",
"summary": "sample config file for server_environment",
"website": "http://www.camptocamp.com", "website": "http://www.camptocamp.com",
"license": "GPL-3 or any later version", "license": "GPL-3 or any later version",
"category": "Tools", "category": "Tools",
"data": [], "data": [],
'installable': False,
'installable': True,
"active": False, "active": False,
} }
Loading…
Cancel
Save