moodle-hat icon indicating copy to clipboard operation
moodle-hat copied to clipboard

Fix permissions after provisioning

Open mackensen opened this issue 11 years ago • 5 comments

Following a full provisioning run there are a couple non-ideal situations:

  • Parts of /home/vagrant are owned root:root, which prevents composer from using the oauth token as the vagrant user
  • Although there's an ACL for vagrant on /var/www/moodle/htdocs, effective permissions wind up being a no-op so you can't reinitialize behat. Apache doesn't need write so owning everything vagrant:vagrant might fix it

mackensen avatar Nov 11 '14 01:11 mackensen

Hello @mackensen love the vagrantfile here, it has really us here at LSU begin the process of integrating Behat testing into our workflow. Based on my previous experiences using Vagrant (outside of Moodle development), I prefer to sync the main project folder (in this case 'htdocs') with my host machine so that I can use IDEs other than Vim to edit files.

I tried to do this by adding this line within the Vagrantfile:

config.vm.synced_folder "./moodle/", "/var/www/moodle/htdocs", create: true, owner: 'vagrant', :mount_options => ["dmode=777", "fmode=777"]

But when I do this it breaks everything. I'm assuming this is because of permissions errors. I see that you are dealing with a slightly similar situation with this issue you have identified. Do you have any suggestions as to how I can sync the htdocs to my host machine and everything work fine?

Again, thanks for this package, it has really helped speed up behat config.

-Chad

chadmazilly avatar Sep 01 '15 21:09 chadmazilly

@chadmazilly thanks, I'm glad you find it useful! I've pushed up a5d6585845fa9d2adb9de50df5f590327a020ed3 which seems to resolve the issue (and incorporates the synced folder by default since that's a good idea). Could you give it a try and let me know?

mackensen avatar Sep 01 '15 23:09 mackensen

Thanks for the quick response! I'm going to test it out tomorrow and will report back.

chadmazilly avatar Sep 01 '15 23:09 chadmazilly

Hi @mackensen although that seemed to be a move in the right direction for syncing folders, I am now getting an error when provisioning, specifically at time of execution of the Moodle Behat configuration manifest:

Error: php admin/tool/behat/cli/init.php returned 255 instead of one of [0]
==> default: Error: /Stage[main]/Moodle::Behat/Exec[configure_behat]/returns: change from notrun to 0 failed: php admin/tool/behat/cli/init.php returned 255 instead of one of [0]

After this happens, a number of tasks seem to fail (configure_phpunit, npm stuff, etc.) due to a dependency failure referencing "configure_behat". It does dump you out quickly after with the moodle installation working and accessible.

Are you experiencing the same thing here? I'm going to play around with it for a bit and see if I can help in any way.

chadmazilly avatar Sep 03 '15 19:09 chadmazilly

Strange; it provisioned cleanly for me. Can you enable the puppet debug mode and re-run the provisioner?

mackensen avatar Sep 04 '15 01:09 mackensen