Skip to content

Commit

Permalink
[IMP] Two new options 'odoo_repo_force' and 'odoo_repo_update' (defau…
Browse files Browse the repository at this point in the history
…lt to True) to have more control on the repository checkout. A checkout will always occured on the first playbook run, even with 'odoo_repo_update: False' (fix issue OCA#8).
  • Loading branch information
sebalix committed Dec 13, 2014
1 parent 57fedb4 commit 5ee7f14
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ odoo_repo_type: git # git or hg
odoo_repo_url: https://github.com/odoo/odoo.git
odoo_repo_dest: "{{ odoo_rootdir }}"
odoo_repo_rev: 8.0
odoo_repo_force: True # Discards uncommited changes. The task will failed if
# local changes exist in the working copy and
# `odoo_repo_force: False` + `odoo_repo_update: True`
odoo_repo_update: True # Update the working copy or not. This option is
# ignored on the first run (a checkout of the working
# copy is always processed)

# Odoo parameters
odoo_config_addons_path: "/home/{{ odoo_user }}/odoo/server/addons,/home/{{ odoo_user }}/odoo/server/openerp/addons"
Expand Down
6 changes: 6 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ odoo_repo_type: git # git or hg
odoo_repo_url: https://github.com/odoo/odoo.git
odoo_repo_dest: "{{ odoo_rootdir }}"
odoo_repo_rev: 8.0
odoo_repo_force: True # Discards uncommited changes. The task will failed if
# local changes exist in the working copy and
# `odoo_repo_force: False` + `odoo_repo_update: True`
odoo_repo_update: True # Update the working copy or not. This option is
# ignored on the first run (a checkout of the working
# copy is always processed)

# Configuration options
odoo_config_addons_path: "/home/{{ odoo_user }}/odoo/server/addons,/home/{{ odoo_user }}/odoo/server/openerp/addons"
Expand Down
12 changes: 7 additions & 5 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
- odoo
- odoo_log

- name: Project repository exists? (Mercurial)
- name: Project repository already cloned?
stat: path={{ odoo_repo_dest }}
register: project_path
tags:
Expand All @@ -48,8 +48,9 @@
hg: repo={{ odoo_repo_url }}
dest={{ odoo_repo_dest }}
revision={{ odoo_repo_rev }}
force=no
when: odoo_repo_type == 'hg' and project_path.stat.exists == False and odoo_repo_url
force={{ odoo_repo_force and 'yes' or 'no' }}
when: odoo_repo_type == 'hg' and odoo_repo_url
and (odoo_repo_update or (project_path.stat.exists == False))
tags:
- odoo
- odoo_project
Expand All @@ -59,8 +60,9 @@
git: repo={{ odoo_repo_url }}
dest={{ odoo_repo_dest }}
version={{ odoo_repo_rev }}
update=no
force=no
update={{ project_path.stat.exists == False and 'yes'
or (odoo_repo_update and 'yes' or 'no') }}
force={{ odoo_repo_force and 'yes' or 'no' }}
when: odoo_repo_type == 'git' and odoo_repo_url
tags:
- odoo
Expand Down

0 comments on commit 5ee7f14

Please sign in to comment.