Re: [Puppet Users] Checking if a directory is a mount point

2018-11-06 Thread 'Prentice Bisbal' via Puppet Users

$fact['mountpoints'] did it. Thanks.

--
Prentice


On 11/6/18 6:54 PM, 'Dan White' via Puppet Users wrote:

Try
$fact[‘mountpoints’]


On Nov 6, 2018, at 6:06 PM, pbisbal via Puppet Users 
mailto:puppet-users@googlegroups.com>> 
wrote:


I want to check to see of a directory is a mount point for a separate 
partition. For example, I'd like to check to see if /tmp is a 
separate partition or is just part of the root partition on a Linux 
system. What is the best way to do this. I thought I could use the in 
operator to see if '/tmp' exists in $fact['partitions']['mount'], but 
that doesn't seem to work. For example, I tried this code, where 
/boot is definitely a separate partition, but /tmp is not:


class mount_points {
  if '/tmp' in $facts['partitions']['mount'] {
    notify { '/tmp is a separate partition': }
  }
  else {
    notify { '/tmp is NOT a separate partition': }
  }
  if "/boot" in $facts['partitions']['mount'] {
    notify { '/boot is a separate partition': }
  }
  else {
    notify { '/boot is NOT a separate partition': }
  }
}

Unfortunately, when I run this, puppet says both directories are NOT 
separate partitions. Is there something wrong with this syntax, or is 
this approach entirely wrong?


Prentice


--
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/6d292a30-1ed0-4d60-93c8-80c65949c765%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.

--
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/4D2DD1DA-6019-4B72-B093-0483D4B51440%40icloud.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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/40c49d42-51cc-8051-8bb1-de98c1dd7171%40pppl.gov.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Checking if a directory is a mount point

2018-11-06 Thread 'Dan White' via Puppet Users
Try
$fact[‘mountpoints’]


> On Nov 6, 2018, at 6:06 PM, pbisbal via Puppet Users 
>  wrote:
> 
> I want to check to see of a directory is a mount point for a separate 
> partition. For example, I'd like to check to see if /tmp is a separate 
> partition or is just part of the root partition on a Linux system. What is 
> the best way to do this. I thought I could use the in operator to see if 
> '/tmp' exists in $fact['partitions']['mount'], but that doesn't seem to work. 
> For example, I tried this code, where /boot is definitely a separate 
> partition, but /tmp is not: 
> 
> class mount_points {
>   if '/tmp' in $facts['partitions']['mount'] {
> notify { '/tmp is a separate partition': }
>   }
>   else {
> notify { '/tmp is NOT a separate partition': }
>   }
>   if "/boot" in $facts['partitions']['mount'] {
> notify { '/boot is a separate partition': }
>   }
>   else {
> notify { '/boot is NOT a separate partition': }
>   }
> }
> 
> Unfortunately, when I run this, puppet says both directories are NOT separate 
> partitions. Is there something wrong with this syntax, or is this approach 
> entirely wrong? 
> 
> Prentice
> 
> 
> -- 
> 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/6d292a30-1ed0-4d60-93c8-80c65949c765%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/4D2DD1DA-6019-4B72-B093-0483D4B51440%40icloud.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Checking if a directory is a mount point

2018-11-06 Thread pbisbal via Puppet Users
I want to check to see of a directory is a mount point for a separate 
partition. For example, I'd like to check to see if /tmp is a separate 
partition or is just part of the root partition on a Linux system. What is 
the best way to do this. I thought I could use the in operator to see if 
'/tmp' exists in $fact['partitions']['mount'], but that doesn't seem to 
work. For example, I tried this code, where /boot is definitely a separate 
partition, but /tmp is not: 

class mount_points {
  if '/tmp' in $facts['partitions']['mount'] {
notify { '/tmp is a separate partition': }
  }
  else {
notify { '/tmp is NOT a separate partition': }
  }
  if "/boot" in $facts['partitions']['mount'] {
notify { '/boot is a separate partition': }
  }
  else {
notify { '/boot is NOT a separate partition': }
  }
}

Unfortunately, when I run this, puppet says both directories are NOT 
separate partitions. Is there something wrong with this syntax, or is this 
approach entirely wrong? 

Prentice


-- 
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/6d292a30-1ed0-4d60-93c8-80c65949c765%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] create an array of hashes with reduce

2018-11-06 Thread Henrik Lindberg

On 2018-11-06 17:13, Arnau wrote:

Hi all,

I'm using puppet 5.3.

I'd like to build proxy_pass array of hashes using the /reduce 
/puppetbuilt-in function 
and picking the 
values from a nested hash in hiera.


I first played a little bit with the reduce function:

$dirs = ['static','media','photos']
$proxy = $dirs.reduce([ { 'path' => '/', 'url' => 
"http://localhost:${port}/; } ]) |$memo, $value| { $memo + [ { 'path' => 
"/$value/", 'url' => '!' } ] }

notify { "MemoOut: $proxy" : ;}

If I puppet apply the above code the output looks like:



Avoid having  notify with a title containing [ ] - it can get very 
confusing. Use a title like "testing", and set the message instead.


You give the reduce an array with a hash in it, and you then append to 
that array with an array containing a hash. The result will be an

array where each element is a hash.


Notice: MemoOut: [{path => /, url => http://localhost:189/}, {path => 
/static/, url => !}, {path => /media/, url => !}, {path => /photos/, url 
=> !}]
Notice: /Stage[main]/Main/Node[default]/Notify[MemoOut: [{path => /, url 
=> http://localhost:189/}, {path => /static/, url => !}, {path => 
/media/, url => !}, {path => /photos/, url => !}]]/message: defined 
'message' as 'MemoOut: [{path => /, url => http://localhost:189/}, {path 
=> /static/, url => !}, {path => /media/, url => !}, {path => /photos/, 
url => !}]'


/To my eyes this is an array of hashes, and that's what I need to pass 
to the apache vhost define./


So, now I want to pick the array (list of directories) from a nested 
hash in hiera that look like:


   application:
     apache:
enable: true
       servername: application
       static_served:
         - static

I have a define that picks the above hash The array with the list of 
directories becomes "${apache['static_served']}" inside teh define.

I can print it using notice ${apache['static_served']}":

Notice: static_served: application [static]

This looks like an array but /*is_array */says that this is *not *an 
array anymore.

And this is my first question, why it is not an array anymore?


I make this an array using any2array (array un puppet 5) so I can still 
call the reduce function::


$var=(Array("${apache['static_served']}"))

so the /reduce /line now looks like:


You are asking Array to create an array out of a string. It will
construct that as an array where each element is a single character string.

You probably wanted

$var = Array($apache['static_served'])

Which by the way is a no-op since $apache['static_served'] already is an 
array (as per the hiera data you supplied).


$_proxy_pass = $var.reduce([ { 'path' => '/', 'url' => 
"http://localhost:${port}/; } ]) |$memo, $value| { $memo + [ { 'path' => 
"/$value/", 'url' => '!' } ] }


And here is where everythiong starts to make even less sense:



You are now performing a reduce based on a sequence of single character 
strings. This is indeed confusing as you have already gone off the road.


Hope this helps you get back on track.

- henrik

If I print the output (using notice $_proxy_pass and )  and I get a 
weird output:


Notice: 
/Stage[main]/.../Python::Virtualenv[application]/Notify[PROXY_PASS: 
[{path => /, url => http://local
host:11080/}, {path => /[/, url => !}, {path => /s/, url => !}, {path => 
/t/, url => !}, {path => /a/, url => !}, {path => /t/, url => !}, {path 
=> /i/, url => !},
  {path => /c/, url => !}, {path => /]/, url => !}]]/message: defined 
'message' as 'PROXY_PASS: [{path => /, url => http://localhost:11080/}, 
{path => /[/, url => !
}, {path => /s/, url => !}, {path => /t/, url => !}, {path => /a/, url 
=> !}, {path => /t/, url => !}, {path => /i/, url => !}, {path => /c/, 
url => !}, {path => /

]/, url => !}]'

reduce is taking all letters from "static" instead of 'static" as the 
first (an uniqe) element from the array


Later, in my code, I configure the proxy_pass in the apache:vhost like:

apache::vhost { "${apache['servername']}":
[...]
proxy_pass     => "$_proxy_pass",
[...]

But, in the apache file, the proxy pass parameters  looks like

ProxyPass path url
  ProxyPassReverse path url
ProxyPass path url
  ProxyPassReverse path url
[...]

So it's picking the keys from the hashes in the above array of hashes 
and not the values.


I don't understand what is going on. Any help will be appreciated.

Best,
Arnau

--
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/CAM69jx-wKXmP%3DhfPLsMsrYDeOS7TCTQaQ9XyhUaoWJ9uq%3DeZEg%40mail.gmail.com 

[Puppet Users] Puppet Enterprise 2019.0.1 now available!

2018-11-06 Thread Eric Sorenson
Dear Puppet Enterprise Users,

Puppet Enterprise 2019.0.1 is now available.

This is a bug fix and minor functionality release of Puppet Enterprise. All 
users of Puppet Enterprise 2019.0.0 are encouraged to upgrade when possible to 
Puppet Enterprise 2019.0.1.

Puppet Enterprise 2019.0.1 includes agent support for Windows Server 2019. It 
includes fixes that caused errors when upgrading from earlier versions, and it 
enables running agentless tasks over WinRM from the orchestrator.

For information on the bug fixes in this release, see 
https://puppet.com/docs/pe/2019.0/release_notes/release_notes.html

As a current Puppet Enterprise user, you can upgrade to this new version as 
part of your annual subscription. To upgrade, you must upgrade your master, 
PuppetDB, and console servers first, then update your agents.

As always, we want to hear about your experiences with Puppet Enterprise. If 
you have any questions about upgrading, be sure to get in touch with Puppet 
Support.

Eric Sorenson - e...@puppet.com 
director of product

-- 
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/9189BE5C-627E-447A-81F8-F83040963372%40puppet.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Puppet Enterprise 2018.1.5 (LTS) is now available

2018-11-06 Thread Eric Sorenson
Dear Puppet Enterprise Users,

Puppet Enterprise 2018.1.5 is now available.

This is a security and bug fix release of the current Long-Term Support (LTS) 
series of Puppet Enterprise. All users of Puppet Enterprise 2018.1.x are 
encouraged to upgrade as soon as possible to Puppet Enterprise 2018.1.5.

Puppet Enterprise 2018.1.5 adds support for SLES 15 and Windows Server 2019 
agents. It also addresses a number of performance issues for large-scale 
console use and includes customer-requested backports, notably around 
improvements to policy-based certificate autosigning.

For full details of the changes in this release, see 
https://puppet.com/docs/pe/2018.1/release_notes/release_notes.html

As a current Puppet Enterprise user, you can upgrade to this new version as 
part of your annual subscription. When upgrading, you must upgrade your master, 
PuppetDB, and console servers first.

As always, we want to hear about your experiences with Puppet Enterprise. If 
you have any questions about upgrading, be sure to get in touch with Puppet 
Support.

Eric Sorenson - e...@puppet.com 
director of product

-- 
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/267F9972-297F-4CDE-8648-17BC7AF82AF9%40puppet.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] create an array of hashes with reduce

2018-11-06 Thread Arnau
Hi all,

I'm using puppet 5.3.

I'd like to build proxy_pass array of hashes using the *reduce *puppet
built-in function  and
picking the values from a nested hash in hiera.

I first played a little bit with the reduce function:

$dirs = ['static','media','photos']
$proxy = $dirs.reduce([ { 'path' => '/', 'url' => "http://localhost:
${port}/" } ]) |$memo, $value| { $memo + [ { 'path' => "/$value/", 'url' =>
'!' } ] }
notify { "MemoOut: $proxy" : ;}

If I puppet apply the above code the output looks like:

Notice: MemoOut: [{path => /, url => http://localhost:189/}, {path =>
/static/, url => !}, {path => /media/, url => !}, {path => /photos/, url =>
!}]
Notice: /Stage[main]/Main/Node[default]/Notify[MemoOut: [{path => /, url =>
http://localhost:189/}, {path => /static/, url => !}, {path => /media/, url
=> !}, {path => /photos/, url => !}]]/message: defined 'message' as 'MemoOut:
[{path => /, url => http://localhost:189/}, {path => /static/, url => !},
{path => /media/, url => !}, {path => /photos/, url => !}]'

*To my eyes this is an array of hashes, and that's what I need to pass to
the apache vhost define.*

So, now I want to pick the array (list of directories) from a nested hash
in hiera that look like:

  application:
apache:
  enable: true
  servername: application
  static_served:
- static

I have a define that picks the above hash The array with the list of
directories becomes "${apache['static_served']}" inside teh define.
I can print it using notice ${apache['static_served']}":

Notice: static_served: application [static]

This looks like an array but *is_array *says that this is *not *an array
anymore.
And this is my first question, why it is not an array anymore?


I make this an array using any2array (array un puppet 5) so I can still
call the reduce function::

$var=(Array("${apache['static_served']}"))

so the *reduce *line now looks like:

$_proxy_pass =  $var.reduce([ { 'path' => '/', 'url' => "http://localhost:
${port}/" } ]) |$memo, $value| { $memo + [ { 'path' => "/$value/", 'url' =>
'!' } ] }

And here is where everythiong starts to make even less sense:

If I print the output (using notice $_proxy_pass and )  and I get a weird
output:

Notice: /Stage[main]/.../Python::Virtualenv[application]/Notify[PROXY_PASS:
[{path => /, url => http://local
host:11080/}, {path => /[/, url => !}, {path => /s/, url => !}, {path => /t/,
url => !}, {path => /a/, url => !}, {path => /t/, url => !}, {path => /i/,
url => !},
 {path => /c/, url => !}, {path => /]/, url => !}]]/message: defined
'message' as 'PROXY_PASS: [{path => /, url => http://localhost:11080/},
{path => /[/, url => !
}, {path => /s/, url => !}, {path => /t/, url => !}, {path => /a/, url =>
!}, {path => /t/, url => !}, {path => /i/, url => !}, {path => /c/, url =>
!}, {path => /
]/, url => !}]'

reduce is taking all letters from "static" instead of 'static" as the first
(an uniqe) element from the array

Later, in my code, I configure the proxy_pass in the apache:vhost like:

apache::vhost { "${apache['servername']}":
[...]
proxy_pass => "$_proxy_pass",
[...]

But, in the apache file, the proxy pass parameters  looks like

 ProxyPass path url
 ProxyPassReverse path url
 ProxyPass path url
 ProxyPassReverse path url
[...]

So it's picking the keys from the hashes in the above array of hashes and
not the values.

I don't understand what is going on. Any help will be appreciated.

Best,
Arnau

-- 
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/CAM69jx-wKXmP%3DhfPLsMsrYDeOS7TCTQaQ9XyhUaoWJ9uq%3DeZEg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.