On Sunday, July 30, 2017 at 11:58:25 AM UTC-5, m ahuja wrote:
>
> I do the following command in a series of commands.
> I make swap using fallocate -l 65G & chmod 0600
> I /sbin/mkswap /mnt/../../swapXXX
> I /bin/echo -en '\n/mnt../../swapXXX swap swap auto 0 0\n' >> /etc/fstab
>
You really ought to use a Mount resource to manage the /etc/fstab entry,
but that's surely unrelated to the problem you describe.
>
> I then do the following and it fails. What am I doing wrong?
>
> exec { "attach swap file":
> command => "/sbin/swapon -af -p 1",
> require => Exec["make fstab entry"],
> unless => "/sbin/swapon -s | grep
> /mnt/ephemeral0/cassandra/swap65G",
> } ->
>
> From log file:
>
> /Stage[main]/Ax::Cassandra::Node/Exec[attach swap file]/returns: executed
> successfully
>
Puppet seems to disagree with you: the command *does not* fail, in the
sense that its exit status is not different from 0.
>
> dmesg shows
> "Adding 68157436k swap on /mnt/ephemeral0/../swap65G. Priority:1
> extents:45 across:72851452k SSFS"
>
>
And that seems to confirm that it did not fail.
> free -m
> total used free sharedbuffers cached
> Mem: 3774 3213561 8106 1646
> -/+ buffers/cache: 1460 2314
> Swap:0 0 0
>
> No swap.
>
But that is indeed odd.
> But if I run the command on command line it runs fine.
> If I do a puppet apply --debug --version it works fine.
>
Did you mean "--verbose"? Anyway, it is odd if the effect on the system
varies with the use of the --debug or --verbose option, but it is not clear
whether those are the only things that differ between the run that has the
result you want and the one that doesn't.
You haven't given us (or at least me) enough to work with. I would like to
see a complete manifest that is sufficient to demonstrate the problem,
together with sufficient procedural instructions for how to reproduce the
incorrect behavior. Until I see those, my best guess is that in your
success case you apply a different, more narrowly-scoped starting manifest,
and there is something else being applied in the failure case that causes
the swap file to be disabled before the end of the run.
John
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/fb209f49-9dd3-4599-a71c-4c53609f93d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.