kitchen synced_folders owner and group

1.3k views Asked by At

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

There are 1 answers

1
Szymon On BEST ANSWER

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.