plone / ansible-playbook

An Ansible playbook for automated deployment of full-stack Plone servers.
90 stars 74 forks source link

Adding add-ons does not run buildout #133

Closed stevepiercy closed 4 years ago

stevepiercy commented 4 years ago

Per the docs to customize Plone with a new egg, I added:

plone_additional_eggs:
  - plone.app.mosaic

plone_additional_versions:
  - "plone.app.mosaic = 2.2.1"

plone_autorun_buildout is yes by default. I ran the playbook. It appears that buildout has not autorun, and the buildout log on the server has not updated since I first set up the server 2 months ago.

polyester commented 4 years ago

Hmm. Can you run with -vvv? I've only had that happen when I'd made a typo in the egg name or version number, or when somehow the network to pypi was flaking out. Both of those will show up with -vvv.

plone-foundation commented 4 years ago

I actually just started seeing this again, and it rang a bell: https://github.com/plone/ansible.plone_server/issues/129

Not sure if it's the same issue, but sounds like it.

On Tue, Jan 21, 2020 at 9:30 AM Paul Roeland notifications@github.com wrote:

Hmm. Can you run with -vvv? I've only had that happen when I'd made a typo in the egg name or version number, or when somehow the network to pypi was flaking out. Both of those will show up with -vvv.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/plone/ansible-playbook/issues/133?email_source=notifications&email_token=AAI6Q4ZM7RITFDDPWPXBK4DQ64WMPA5CNFSM4KJTGMU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJQSINY#issuecomment-576791607, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI6Q43BKHIBH32YMIF2M43Q64WMPANCNFSM4KJTGMUQ .

--

Fulvio Casali

stevepiercy commented 4 years ago

After synching up my playbook with master, it doesn't look like anything changes after running the playbook again.

I tried with -vvv, and found this relevant step:

TASK [plone.plone_server : Run buildout - output goes to /usr/local/plone-5.2/zeoserver/buildout.log] ************************
task path: /<sikrit>/plone/ansible-playbook/roles/plone.plone_server/tasks/main.yml:274
skipping: [sikrit.stevepiercy.com] => {
    "changed": false,
    "skip_reason": "Conditional result was False"
}

Here's the when clause.

  when: instance_config.plone_always_run_buildout or
        instance_config.plone_autorun_buildout and
        (instance_status.changed or requirements_status.changed or extra_dir_copy_result.changed or not
        buildout_status.stat.exists)

And my settings:

plone_always_run_buildout: no
plone_autorun_buildout: yes

Is there some way to debug this further, maybe get each of the actual values in the when clause?

fulv commented 4 years ago

How about

    - debug: "{{ requirements_status }}"
    - debug: "{{ instance_status }}"

(my syntax may be off)

stevepiercy commented 4 years ago

Thanks for the tip. I found the docs for debug syntax.

- debug:
    msg: instance_config.plone_always_run_buildout is {{ instance_config.plone_always_run_buildout }} and instance_config.plone_autorun_buildout is {{ instance_config.plone_autorun_buildout }}

- debug:
    var: instance_status.changed

- debug:
    var: requirements_status.changed

- debug:
    var: extra_dir_copy_result.changed

- debug:
    var: buildout_status.stat.exists

Pruned results:

    "msg": "instance_config.plone_always_run_buildout is False and instance_config.plone_autorun_buildout is True"
    "instance_status.changed": false
    "requirements_status.changed": false
    "extra_dir_copy_result.changed": false
    "buildout_status.stat.exists": true

One of the last 4 vars should be its opposite when I add an item to plone_additional_eggs, but which? Tracing through the playbook, I found instance_config.plone_additional_eggs in buildout.cfg.j2, so I think that instance_status.changed should be true. However when I run my playbook, the step that registers instance_status, Copy buildout template, is skipped.

- name: Copy buildout template
  when: not instance_config.plone_buildout_git_repo
  template:
    src=buildout.cfg.j2
    dest={{ plone_instance_home }}/{{ instance_config.plone_buildout_cfg }}
    owner={{ instance_config.plone_buildout_user }}
    group={{ instance_config.plone_group }}
    backup=yes
  register: instance_status

plone_buildout_git_repo is None by default.

Should the when clause instead be this, as it is in a couple of other steps?

when: (instance_config.plone_buildout_git_repo is defined) and (instance_config.plone_buildout_git_repo)

fulv commented 4 years ago

not instance_config.plone_buildout_git_repo == not None == True by default. So, by default, Copy buildout template should run every single time, and I think that is as it should be. The question then is whether instance_status.changed is True. Did you actually modify your plone_addiitonal_eggs right before running the playbook with the debug tasks in it? Because instance_status.changed will only be True the first time you run it after you changed something. Every time after that it will be False.

stevepiercy commented 4 years ago

OK, that explains it. The problem was that I had not yet merged the fix from master to my playbook when I added the egg. After that first run, and after merging the fix from master, the task would never run.

To trick it, I removed the egg item, ran the playbook, added the egg item back, ran it again.

$ grep mosaic /usr/local/plone-5.2/zeoserver/buildout.log
Getting distribution for 'plone.app.mosaic==2.2.1'.
Got plone.app.mosaic 2.2.1.

Thank you! I learned a few things here.

plone-foundation commented 4 years ago

Cool, me too!

On Sat, Jan 25, 2020 at 2:54 PM Steve Piercy notifications@github.com wrote:

Closed #133 https://github.com/plone/ansible-playbook/issues/133.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/plone/ansible-playbook/issues/133?email_source=notifications&email_token=AAI6Q4ZRIEGUBE6YEEYY5QTQ7S7JVA5CNFSM4KJTGMU2YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOWGMN7AY#event-2979585923, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI6Q4ZHI724YXCOX3FBU6DQ7S7JVANCNFSM4KJTGMUQ .

--

Fulvio Casali