2

I am trying to spin a chef cookbook with kitchen converge. I have synced_folders set up which are created correctly, however I can not assign the desired USER:GROUP. There is no kitchen documentation on how to do it and I have tried different ways which either generates error or gets ignored. I have been able to do so without any issue on Vagrantfile and this is the way it is handles on Vagrant:

myvm.vm.synced_folder "~/Workspace/test", "/opt/apps/test/synced", owner: "www", group: "www"

here is how I have tried to achieve the same thing using kitchen but as I stated it only creates the folder with default user(vagrant)

suites:
  - name: myvm
    driver:
      vm_hostname: myvm.kitchen.verifi
      network:
        - ["private_network", {ip: "192.168.50.14"}]
      synced_folders:
        - ["~/Workspace/test", "/opt/apps/test/synced", "create: true", "owner: www-data", "group: www-data"]

the above only creates the folder changing it to :

  synced_folders:
    - ["~/Workspace/test", "/opt/apps/test/synced", "create: true", "owner: www-data group: www-data"]

was basically the same, the owner and groups get ignored

changing it to :

  synced_folders:
    - ["~/Workspace/test", "/opt/apps/test/synced", "create: true owner: www-data group: www-data"]

generates error. No matter what combinations I use it does not succeed.

1 Answer 1

3

After looking at Vagrant doc, I think you should put commas inside a third element of the array and user/group should be in quotes. Try;

synced_folders:
  - ["~/Workspace/test", "/opt/apps/test/synced", 'create: true, owner: "www-data", group: "www-data"']

Whole third parameter should be put directly in Vagrantfile as-is.

1
  • Thank you, this syntax is working. the difference I see is having the whole thing inside a single code and only double coding the user and permission part.
    – al gh
    Dec 23, 2016 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.