sous-chefs / lvm

Development repository for the lvm cookbook
https://supermarket.chef.io/cookbooks/lvm
Apache License 2.0
56 stars 122 forks source link

Cloning resource attributes for mount[/mnt/data] from prior resource (CHEF-3694) #112

Open EugenMayer opened 7 years ago

EugenMayer commented 7 years ago

Pretty much the same as https://github.com/chef-cookbooks/apt/pull/214/files

- /tmp/kitchen/cache/cookbooks/lvm/libraries/provider_lvm_logical_volume.rb:97:in `action_create'
         Cloning resource attributes for mount[/mnt/data] from prior resource (CHEF-3694)
       Previous mount[/mnt/data]: /tmp/kitchen/cache/cookbooks/lvm/libraries/provider_lvm_logical_volume.rb:110:in `action_create'
       Current  mount[/mnt/data]: /tmp/kitchen/cache/cookbooks/lvm/libraries/provider_lvm_logical_volume.rb:110:in `action_create' at 1 location:
           - /tmp/kitchen/cache/cookbooks/lvm/libraries/provider_lvm_logical_volume.rb:110:in `action_create'

So it should be about https://github.com/chef-cookbooks/lvm/blob/master/libraries/provider_lvm_logical_volume.rb#L110 changed to

mount_resource = mount "cleanup_#{mount_spec[:location]}" do
            location mount_spec[:location]
            options mount_spec[:options]
            dump mount_spec[:dump]
            pass mount_spec[:pass]
            device device_name
            fstype fs_type
            action :nothing
          end

I can provide a PR if someone at least tells me i am going into the right direction

EugenMayer commented 7 years ago
  # Create the mount point
          dir_resource = directory "cleanup_#{mount_spec[:location]}" do
            path mount_spec[:location]
            mode '755'
            owner 'root'
            group 'root'
            recursive true
            action :nothing
            not_if { Pathname.new(mount_spec[:location]).mountpoint? }
          end
          dir_resource.run_action(:create)
          # Mark the resource as updated if the directory resource is updated
          updates << dir_resource.updated?

          # Mount the logical volume
          mount_resource = mount "cleanup_#{mount_spec[:location]}" do
            mount_point mount_spec[:location]
            dump mount_spec[:dump]
            pass mount_spec[:pass]
            device device_name
            fstype fs_type
            action :nothing
          end

Would be somekind of a thing, but it does not help for me. I do not ge then implicit clone issue at all while reading http://tickets.chef.io/browse/CHEF-3694 so i am stuck in the woods

MarkGibbons commented 7 years ago

@EugenMayer It looks like you might have a recipe with multiple logical volume resources that specify the mount point /mnt/data/.

Regards, Marks

EugenMayer commented 7 years ago

@markan no, its exactly one - its the only lvm usage at all. Its a very basic (test) recipe

tas50 commented 7 years ago

If we switch to use_inline_resources this will probably go away.