Found a clue: 

http://docs.puppetlabs.com/references/latest/type.html#mount 

ensure Control what to do with this mount. Set this attribute to umounted to 
make sure the filesystem is in the filesystem table but not mounted (if the 
filesystem is currently mounted, it will be unmounted). Set it to absent to 
unmount (if necessary) and remove the filesystem from the fstab. Set to mounted 
to add it to the fstab and mount it. Set to present to add to fstab but not 
change mount/unmount status. Valid values are defined (also called present ), 
unmounted , absent , mounted . 
So maybe you want to use mounted/unmounted rather than present/absent ! 


“Sometimes I think the surest sign that intelligent life exists elsewhere in 
the universe is that none of it has tried to contact us.” 
Bill Waterson (Calvin & Hobbes) 

----- Original Message -----
From: "iamauser" <tapas.sara...@gmail.com> 
To: puppet-users@googlegroups.com 
Sent: Friday, January 18, 2013 3:00:22 PM 
Subject: [Puppet Users] Re: two mounts with the same name (one present, one 
absent) 





<blockquote>
Two mounts defined as virtual resources with same name but different fstype. 
One is is ensuring present, other absent. Puppet doesn't like it, 
Looking at a bug report earlier ( http://projects.puppetlabs.com/issues/7491 ), 
I followed the suggestion, but it doesn't help. puppet throws this error : 




You cannot declare multiple configurations of the same resource for the same 
target node. This constraint covers all resource declarations equally, 
including those of virtual and exported resources. Where it knows how to do so, 
Puppet intentionally recognizes and blocks attempts to disguise multiple 
declarations by use of different resource titles (contrary to some of the 
comments on issue 7491, but imho correctly). 


</blockquote>


I agree with your opinion here because the comments on issue 7941 doesn't work. 
My case is a bit strange though. As you could see, I want to make the same 
mount "absent" only if the fstype is different from what was defined originally 
for "present". And both these operation should happen in the same node. 


I had tried declaring a single virtual resource and then change the fstype and 
ensure parameter. It doesn't work as I want. It removes the mount point 
"/data/01" that was initially present and simply ignores the change in the 
fstype. See e.g., 


class cl::mount { 


@mount { 
"mnt_sdisk_3" : 
device => "/dev/sdb1", 
name => "/data/01", 
fstype => "auto", 
options => "defaults", 
dump => "0", 
pass => "0", 
ensure => present; 
} 

} 


class cl::test_mount inherits cl::mount { 
realize(Mount["mnt_sdisk_3"]) 
Mount["mnt_sdisk_3"] { 
fstype => "ext3", 
ensure => absent, 
} 
} 


Notice: /Stage[main]/Cl::Mount/Mount[mnt_sdisk_3]/ensure: current_value 
mounted, should be absent (noop) 





Note that I am testing this on a machine where the change shouldn't happen 
because there is no "ext3" fstype with name "/data/01" in /etc/fstab. 


I guess this is a very special case and probably I have to deal with this by 
editing fstab using Exec. 





Cheers 
<blockquote>



</blockquote>


-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group. 
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/qnFIsP5uO4AJ . 
To post to this group, send email to puppet-users@googlegroups.com. 
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com. 
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en. 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to