Jira (PUP-8114) Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.

2017-11-02 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl created an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8114 
 
 
 
  Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.  
 
 
 
 
 
 
 
 
 

Issue Type:
 
  Bug 
 
 
 

Affects Versions:
 

 PUP 4.10.4 
 
 
 

Assignee:
 
 Reid Wahl 
 
 
 

Components:
 

 Types and Providers 
 
 
 

Created:
 

 2017/11/02 1:55 AM 
 
 
 

Environment:
 
 
SLES 11 I'm running SP3 on a VMware virtual machine but should not be relevant. 
 
 
 

Priority:
 
  Normal 
 
 
 

Reporter:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 
Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11. 
SLES 11 has a list of Sys V services beginning with the string 'boot.' that do not behave like other services when `chkconfig` is run against them. To illustrate: ``` $ cat /etc/SuSE-release SUSE Linux Enterprise Server 11 (x86_64) VERSION = 11 PATCHLEVEL = 3 
 

Service is running $ /sbin/service boot.kdump status kdump kernel loaded running
 

Jira (PUP-8114) Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.

2017-11-02 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8114 
 
 
 
  Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.SLES 11 has a list of Sys V services beginning with the string 'boot.' that do not behave like other services when `chkconfig` is run against them. To illustrate: ``` {{ $ cat /etc/SuSE-releaseSUSE Linux Enterprise Server 11 (x86_64)VERSION = 11PATCHLEVEL = 3# Service is running$ /sbin/service boot.kdump statuskdump kernel loaded running# chkconfig shows 'B'$ /sbin/chkconfig boot.kdumpboot.kdump  B# Only appears when --allservices is specified$ /sbin/chkconfig --list | grep kdump$ /sbin/chkconfig --list --allservices | grep kdumpboot.kdump0:off  1:off  2:off  3:off  4:off  5:off  6:off  B:on# Compare with "normal" service$ /sbin/service ntp status...Checking for network time protocol daemon (NTPD):running# chkconfig shows 'on', not 'B'$ /sbin/chkconfig ntpntp  on }}  ```   The provider script ( ` {{ puppet/lib/puppet/provider/service/redhat.rb ` }} ) uses the following function to test whether a service is enabled. ``` {{   def enabled?name = @resource[:name]begin  output = chkconfig namerescue Puppet::ExecutionFailure  return :falseend# For Suse OS family, chkconfig returns 0 even if the service is disabled or non-existent# Therefore, check the output for '  on' to see if it is enabledreturn :false unless Facter.value(:osfamily) != 'Suse' || output =~ /^#{name}\s+on$/:true  end }}  ```   It accounts for the fact that SLES, unlike RHEL, returns a zero return code in the event that a service is disabled or nonexistent: ``` {{ $ /sbin/chkconfig asdfasdf: unknown service$ echo $?0 }}  ```   It doesn't trigger the `rescue` block. So, if the OS family is 'Suse' and  `  {{ output ` }}  contains the service name followed by  `  {{ 'on' ` }} , it returns  `  {{ true ` }} . However, as we've seen above, the  `  {{ boot.* ` }}  services print an output of  `  {{  B ` }}  and thus return  `  {{ false ` }}  even when enabled. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
  

Jira (PUP-8114) Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.

2017-11-02 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8114 
 
 
 
  Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.SLES 11 has a list of Sys V services beginning with the string 'boot.' that do not behave like other services when `chkconfig` is run against them. To illustrate:{ { code:java} $ cat /etc/SuSE-releaseSUSE Linux Enterprise Server 11 (x86_64)VERSION = 11PATCHLEVEL = 3# Service is running$ /sbin/service boot.kdump statuskdump kernel loaded running# chkconfig shows 'B'$ /sbin/chkconfig boot.kdumpboot.kdump  B# Only appears when --allservices is specified$ /sbin/chkconfig --list | grep kdump$ /sbin/chkconfig --list --allservices | grep kdumpboot.kdump0:off  1:off  2:off  3:off  4:off  5:off  6:off  B:on# Compare with "normal" service$ /sbin/service ntp status...Checking for network time protocol daemon (NTPD):running# chkconfig shows 'on', not 'B'$ /sbin/chkconfig ntpntp  on {code } } The provider script ({{puppet/lib/puppet/provider/service/redhat.rb}}) uses the following function to test whether a service is enabled.{{  def enabled?name = @resource[:name]begin  output = chkconfig namerescue Puppet::ExecutionFailure  return :falseend# For Suse OS family, chkconfig returns 0 even if the service is disabled or non-existent# Therefore, check the output for '  on' to see if it is enabledreturn :false unless Facter.value(:osfamily) != 'Suse' || output =~ /^#{name}\s+on$/:true  end}}It accounts for the fact that SLES, unlike RHEL, returns a zero return code in the event that a service is disabled or nonexistent:{{$ /sbin/chkconfig asdfasdf: unknown service$ echo $?0}}It doesn't trigger the `rescue` block. So, if the OS family is 'Suse' and {{output}} contains the service name followed by {{'on'}}, it returns {{true}}. However, as we've seen above, the {{boot.*}} services print an output of {{ B}} and thus return {{false}} even when enabled. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
   

Jira (PUP-8114) Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.

2017-11-02 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8114 
 
 
 
  Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.SLES 11 has a list of Sys V services beginning with the string 'boot.' that do not behave like other services when `chkconfig` is run against them. To illustrate:{code: java bash }$ cat /etc/SuSE-releaseSUSE Linux Enterprise Server 11 (x86_64)VERSION = 11PATCHLEVEL = 3# Service is running$ /sbin/service boot.kdump statuskdump kernel loaded running# chkconfig shows 'B'$ /sbin/chkconfig boot.kdumpboot.kdump  B# Only appears when --allservices is specified$ /sbin/chkconfig --list | grep kdump$ /sbin/chkconfig --list --allservices | grep kdumpboot.kdump0:off  1:off  2:off  3:off  4:off  5:off  6:off  B:on# Compare with "normal" service$ /sbin/service ntp status...Checking for network time protocol daemon (NTPD):running# chkconfig shows 'on', not 'B'$ /sbin/chkconfig ntpntp  on{code}The provider script ({{puppet/lib/puppet/provider/service/redhat.rb}}) uses the following function to test whether a service is enabled.{{  def enabled?name = @resource[:name]begin  output = chkconfig namerescue Puppet::ExecutionFailure  return :falseend# For Suse OS family, chkconfig returns 0 even if the service is disabled or non-existent# Therefore, check the output for '  on' to see if it is enabledreturn :false unless Facter.value(:osfamily) != 'Suse' || output =~ /^#{name}\s+on$/:true  end}}It accounts for the fact that SLES, unlike RHEL, returns a zero return code in the event that a service is disabled or nonexistent:{{$ /sbin/chkconfig asdfasdf: unknown service$ echo $?0}}It doesn't trigger the `rescue` block. So, if the OS family is 'Suse' and {{output}} contains the service name followed by {{'on'}}, it returns {{true}}. However, as we've seen above, the {{boot.*}} services print an output of {{ B}} and thus return {{false}} even when enabled. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 

Jira (PUP-8114) Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.

2017-11-02 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8114 
 
 
 
  Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.SLES 11 has a list of Sys V services beginning with the string 'boot.' that do not behave like other services when `chkconfig` is run against them. To illustrate:{code:bash}$ cat /etc/SuSE-releaseSUSE Linux Enterprise Server 11 (x86_64)VERSION = 11PATCHLEVEL = 3# Service is running$ /sbin/service boot.kdump statuskdump kernel loaded running# chkconfig shows 'B'$ /sbin/chkconfig boot.kdumpboot.kdump  B# Only appears when --allservices is specified$ /sbin/chkconfig --list | grep kdump$ /sbin/chkconfig --list --allservices | grep kdumpboot.kdump0:off  1:off  2:off  3:off  4:off  5:off  6:off  B:on# Compare with "normal" service$ /sbin/service ntp status...Checking for network time protocol daemon (NTPD):running# chkconfig shows 'on', not 'B'$ /sbin/chkconfig ntpntp  on{code}The provider script ({{puppet/lib/puppet/provider/service/redhat.rb}}) uses the following function to test whether a service is enabled.{ { code:bash}   def enabled?name = @resource[:name]begin  output = chkconfig namerescue Puppet::ExecutionFailure  return :falseend# For Suse OS family, chkconfig returns 0 even if the service is disabled or non-existent# Therefore, check the output for '  on' to see if it is enabledreturn :false unless Facter.value(:osfamily) != 'Suse' || output =~ /^#{name}\s+on$/:true  end {code } } It accounts for the fact that SLES, unlike RHEL, returns a zero return code in the event that a service is disabled or nonexistent:{ { code:bash} $ /sbin/chkconfig asdfasdf: unknown service$ echo $?0 {code } } It doesn't trigger the `rescue` block. So, if the OS family is 'Suse' and {{output}} contains the service name followed by {{'on'}}, it returns {{true}}. However, as we've seen above, the {{boot.*}} services print an output of {{ B}} and thus return {{false}} even when enabled. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
  

Jira (PUP-8114) Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.

2017-11-02 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8114 
 
 
 
  Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.SLES 11 has a list of Sys V services beginning with the string 'boot.' that do not behave like other services when `chkconfig` is run against them. To illustrate:{code:bash}$ cat /etc/SuSE-releaseSUSE Linux Enterprise Server 11 (x86_64)VERSION = 11PATCHLEVEL = 3# Service is running$ /sbin/service boot.kdump statuskdump kernel loaded running# chkconfig shows 'B'$ /sbin/chkconfig boot.kdumpboot.kdump  B# Only appears when --allservices is specified$ /sbin/chkconfig --list | grep kdump$ /sbin/chkconfig --list --allservices | grep kdumpboot.kdump0:off  1:off  2:off  3:off  4:off  5:off  6:off  B:on# Compare with "normal" service$ /sbin/service ntp status...Checking for network time protocol daemon (NTPD):running# chkconfig shows 'on', not 'B'$ /sbin/chkconfig ntpntp  on{code}The provider script ({{puppet/lib/puppet/provider/service/redhat.rb}}) uses the following function to test whether a service is enabled.{code: bash ruby }  def enabled?name = @resource[:name]begin  output = chkconfig namerescue Puppet::ExecutionFailure  return :falseend# For Suse OS family, chkconfig returns 0 even if the service is disabled or non-existent# Therefore, check the output for '  on' to see if it is enabledreturn :false unless Facter.value(:osfamily) != 'Suse' || output =~ /^#{name}\s+on$/:true  end{code}It accounts for the fact that SLES, unlike RHEL, returns a zero return code in the event that a service is disabled or nonexistent:{code:bash}$ /sbin/chkconfig asdfasdf: unknown service$ echo $?0{code}It doesn't trigger the `rescue` block. So, if the OS family is 'Suse' and {{output}} contains the service name followed by {{'on'}}, it returns {{true}}. However, as we've seen above, the {{boot.*}} services print an output of {{ B}} and thus return {{false}} even when enabled. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 

Jira (PUP-8114) Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.

2017-11-02 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8114 
 
 
 
  Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.SLES 11 has a list of Sys V services beginning with the string 'boot.' that do not behave like other services when  `  {{ chkconfig ` }}  is run against them. To illustrate:{code:bash}$ cat /etc/SuSE-releaseSUSE Linux Enterprise Server 11 (x86_64)VERSION = 11PATCHLEVEL = 3# Service is running$ /sbin/service boot.kdump statuskdump kernel loaded running# chkconfig shows 'B'$ /sbin/chkconfig boot.kdumpboot.kdump  B# Only appears when --allservices is specified$ /sbin/chkconfig --list | grep kdump$ /sbin/chkconfig --list --allservices | grep kdumpboot.kdump0:off  1:off  2:off  3:off  4:off  5:off  6:off  B:on# Compare with "normal" service$ /sbin/service ntp status...Checking for network time protocol daemon (NTPD):running# chkconfig shows 'on', not 'B'$ /sbin/chkconfig ntpntp  on{code}The provider script ({{puppet/lib/puppet/provider/service/redhat.rb}}) uses the following function to test whether a service is enabled.{code:ruby}  def enabled?name = @resource[:name]begin  output = chkconfig namerescue Puppet::ExecutionFailure  return :falseend# For Suse OS family, chkconfig returns 0 even if the service is disabled or non-existent# Therefore, check the output for '  on' to see if it is enabledreturn :false unless Facter.value(:osfamily) != 'Suse' || output =~ /^#{name}\s+on$/:true  end{code}It accounts for the fact that SLES, unlike RHEL, returns a zero return code in the event that a service is disabled or nonexistent:{code:bash}$ /sbin/chkconfig asdfasdf: unknown service$ echo $?0{code}It doesn't trigger the `rescue` block. So, if the OS family is 'Suse' and {{output}} contains the service name followed by {{'on'}}, it returns {{true}}. However, as we've seen above, the {{boot.*}} services print an output of {{ B}} and thus return {{false}} even when enabled. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 

Jira (PUP-8114) Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.

2017-11-02 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-8114 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.  
 
 
 
 
 
 
 
 
 
 
I can put together a PR for this tomorrow if no one has hit it by then. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-8114) Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.

2017-11-02 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8114 
 
 
 
  Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.SLES 11 has a list of Sys V services beginning with the string 'boot.' that do not behave like other services when {{chkconfig}} is run against them. To illustrate:{code:bash}$ cat /etc/SuSE-releaseSUSE Linux Enterprise Server 11 (x86_64)VERSION = 11PATCHLEVEL = 3# Service is running$ /sbin/service boot.kdump statuskdump kernel loaded running# chkconfig shows 'B'$ /sbin/chkconfig boot.kdumpboot.kdump  B# Only appears when --allservices is specified$ /sbin/chkconfig --list | grep kdump$ /sbin/chkconfig --list --allservices | grep kdumpboot.kdump0:off  1:off  2:off  3:off  4:off  5:off  6:off  B:on# Compare with "normal" service$ /sbin/service ntp status...Checking for network time protocol daemon (NTPD):running# chkconfig shows 'on', not 'B'$ /sbin/chkconfig ntpntp  on{code}The provider script ({{puppet/lib/puppet/provider/service/redhat.rb}}) uses the following function to test whether a service is enabled.{code:ruby}  def enabled?name = @resource[:name]begin  output = chkconfig namerescue Puppet::ExecutionFailure  return :falseend# For Suse OS family, chkconfig returns 0 even if the service is disabled or non-existent# Therefore, check the output for '  on' to see if it is enabledreturn :false unless Facter.value(:osfamily) != 'Suse' || output =~ /^#{name}\s+on$/:true  end{code}It accounts for the fact that SLES, unlike RHEL, returns a zero return code in the event that a service is disabled or nonexistent:{code:bash}$ /sbin/chkconfig asdfasdf: unknown service$ echo $?0{code} It This  doesn't trigger the `rescue` block. So, if the OS family is 'Suse' and {{output}} contains the service name followed by {{'on'}}, it returns {{true}}. However, as we've seen above, the {{boot.*}} services print an output of {{ B}} and thus return {{false}} even when enabled. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
   

Jira (PUP-8114) Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.

2017-11-02 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8114 
 
 
 
  Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11. Pull request: https://github.com/puppetlabs/puppet/pull/6333 SLES 11 has a list of Sys V services beginning with the string 'boot.' that do not behave like other services when {{chkconfig}} is run against them. To illustrate:{code:bash}$ cat /etc/SuSE-releaseSUSE Linux Enterprise Server 11 (x86_64)VERSION = 11PATCHLEVEL = 3# Service is running$ /sbin/service boot.kdump statuskdump kernel loaded running# chkconfig shows 'B'$ /sbin/chkconfig boot.kdumpboot.kdump  B# Only appears when --allservices is specified$ /sbin/chkconfig --list | grep kdump$ /sbin/chkconfig --list --allservices | grep kdumpboot.kdump0:off  1:off  2:off  3:off  4:off  5:off  6:off  B:on# Compare with "normal" service$ /sbin/service ntp status...Checking for network time protocol daemon (NTPD):running# chkconfig shows 'on', not 'B'$ /sbin/chkconfig ntpntp  on{code}The provider script ({{puppet/lib/puppet/provider/service/redhat.rb}}) uses the following function to test whether a service is enabled.{code:ruby}  def enabled?name = @resource[:name]begin  output = chkconfig namerescue Puppet::ExecutionFailure  return :falseend# For Suse OS family, chkconfig returns 0 even if the service is disabled or non-existent# Therefore, check the output for '  on' to see if it is enabledreturn :false unless Facter.value(:osfamily) != 'Suse' || output =~ /^#{name}\s+on$/:true  end{code}It accounts for the fact that SLES, unlike RHEL, returns a zero return code in the event that a service is disabled or nonexistent:{code:bash}$ /sbin/chkconfig asdfasdf: unknown service$ echo $?0{code}This doesn't trigger the `rescue` block. So, if the OS family is 'Suse' and {{output}} contains the service name followed by {{'on'}}, it returns {{true}}. However, as we've seen above, the {{boot.*}} services print an output of {{ B}} and thus return {{false}} even when enabled. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 

Jira (PUP-8114) Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.

2017-11-02 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8114 
 
 
 
  Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.Pull request: https://github.com/puppetlabs/puppet/pull/6333SLES 11 has a list of Sys V services beginning with the string 'boot.' that do not behave like other services when {{chkconfig}} is run against them. To illustrate:{code:bash}$ cat /etc/SuSE-releaseSUSE Linux Enterprise Server 11 (x86_64)VERSION = 11PATCHLEVEL = 3# Service is running$ /sbin/service boot.kdump statuskdump kernel loaded running# chkconfig shows 'B'$ /sbin/chkconfig boot.kdumpboot.kdump  B# Only appears when --allservices is specified$ /sbin/chkconfig --list | grep kdump$ /sbin/chkconfig --list --allservices | grep kdumpboot.kdump0:off  1:off  2:off  3:off  4:off  5:off  6:off  B:on# Compare with "normal" service$ /sbin/service ntp status...Checking for network time protocol daemon (NTPD):running# chkconfig shows 'on', not 'B'$ /sbin/chkconfig ntpntp  on{code}The provider script ({{puppet/lib/puppet/provider/service/redhat.rb}}) uses the following function to test whether a service is enabled.{code:ruby}  def enabled?name = @resource[:name]begin  output = chkconfig namerescue Puppet::ExecutionFailure  return :falseend# For Suse OS family, chkconfig returns 0 even if the service is disabled or non-existent# Therefore, check the output for '  on' to see if it is enabledreturn :false unless Facter.value(:osfamily) != 'Suse' || output =~ /^#{name}\s+on$/:true  end{code}It accounts for the fact that SLES, unlike RHEL, returns a zero return code in the event that a service is disabled or nonexistent:{code:bash}$ /sbin/chkconfig asdfasdf: unknown service$ echo $?0{code}This doesn't trigger the `rescue` block  with its {{false}] return value as a disabled or nonexistent service would for RHEL .   So, if the OS family is 'Suse' and {{output}} contains the service name followed by {{'on'}}, it returns {{true}}. However, as we've seen above, the {{boot.*}} services print an output of {{ B}} and thus return {{false}} even when enabled. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
  

Jira (PUP-8114) Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.

2017-11-02 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8114 
 
 
 
  Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.Pull request: https://github.com/puppetlabs/puppet/pull/6333SLES 11 has a list of Sys V services beginning with the string 'boot.' that do not behave like other services when {{chkconfig}} is run against them. To illustrate:{code:bash}$ cat /etc/SuSE-releaseSUSE Linux Enterprise Server 11 (x86_64)VERSION = 11PATCHLEVEL = 3# Service is running$ /sbin/service boot.kdump statuskdump kernel loaded running# chkconfig shows 'B'$ /sbin/chkconfig boot.kdumpboot.kdump  B# Only appears when --allservices is specified$ /sbin/chkconfig --list | grep kdump$ /sbin/chkconfig --list --allservices | grep kdumpboot.kdump0:off  1:off  2:off  3:off  4:off  5:off  6:off  B:on# Compare with "normal" service$ /sbin/service ntp status...Checking for network time protocol daemon (NTPD):running# chkconfig shows 'on', not 'B'$ /sbin/chkconfig ntpntp  on{code}The provider script ({{puppet/lib/puppet/provider/service/redhat.rb}}) uses the following function to test whether a service is enabled.{code:ruby}  def enabled?name = @resource[:name]begin  output = chkconfig namerescue Puppet::ExecutionFailure  return :falseend# For Suse OS family, chkconfig returns 0 even if the service is disabled or non-existent# Therefore, check the output for '  on' to see if it is enabledreturn :false unless Facter.value(:osfamily) != 'Suse' || output =~ /^#{name}\s+on$/:true  end{code}It accounts for the fact that SLES, unlike RHEL, returns a zero return code in the event that a service is disabled or nonexistent:{code:bash}$ /sbin/chkconfig asdfasdf: unknown service$ echo $?0{code}This doesn't trigger the `rescue` block with its {{false}}   return value as a disabled or nonexistent service would for RHEL.So, if the OS family is 'Suse' and {{output}} contains the service name followed by {{'on'}}, it returns {{true}}. However, as we've seen above, the {{boot.*}} services print an output of {{ B}} and thus return {{false}} even when enabled. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 

Jira (PUP-8114) Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.

2017-11-02 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-8114 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.  
 
 
 
 
 
 
 
 
 
 
https://github.com/puppetlabs/puppet/pull/6333 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-8114) Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.

2017-11-02 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8114 
 
 
 
  Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.Pull request: https://github.com/puppetlabs/puppet/pull/6333SLES 11 has a list of Sys V services beginning with the string 'boot.' that do not behave like other services when {{chkconfig}} is run against them. To illustrate:{code:bash}$ cat /etc/SuSE-releaseSUSE Linux Enterprise Server 11 (x86_64)VERSION = 11PATCHLEVEL = 3# Service is running$ /sbin/service boot.kdump statuskdump kernel loaded running# chkconfig shows 'B'$ /sbin/chkconfig boot.kdumpboot.kdump  B# Only appears when --allservices is specified$ /sbin/chkconfig --list | grep kdump$ /sbin/chkconfig --list --allservices | grep kdumpboot.kdump0:off  1:off  2:off  3:off  4:off  5:off  6:off  B:on# Compare with "normal" service$ /sbin/service ntp status...Checking for network time protocol daemon (NTPD):running# chkconfig shows 'on', not 'B'$ /sbin/chkconfig ntpntp  on{code}The provider script ({{puppet/lib/puppet/provider/service/redhat.rb}}) uses the following function to test whether a service is enabled.{code:ruby}  def enabled?name = @resource[:name]begin  output = chkconfig namerescue Puppet::ExecutionFailure  return :falseend# For Suse OS family, chkconfig returns 0 even if the service is disabled or non-existent# Therefore, check the output for '  on' to see if it is enabledreturn :false unless Facter.value(:osfamily) != 'Suse' || output =~ /^#{name}\s+on$/:true  end{code}It accounts for the fact that SLES, unlike RHEL, returns a zero return code in the event that a service is disabled or nonexistent:{code:bash}$ /sbin/chkconfig asdfasdf: unknown service$ echo $?0{code}This doesn't trigger the `rescue` block with its {{false} ] }  return value as a disabled or nonexistent service would for RHEL.So, if the OS family is 'Suse' and {{output}} contains the service name followed by {{'on'}}, it returns {{true}}. However, as we've seen above, the {{boot.*}} services print an output of {{ B}} and thus return {{false}} even when enabled. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
   

Jira (PUP-8114) Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.

2017-11-02 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8114 
 
 
 
  Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 Service provider 'redhat' does not correctly detect enabled state of 'boot.*' services on SLES 11.Pull request: https://github.com/puppetlabs/puppet/pull/6333SLES 11 has a list of Sys V services beginning with the string 'boot.' that do not behave like other services when {{chkconfig}} is run against them. To illustrate:{code:bash}$ cat /etc/SuSE-releaseSUSE Linux Enterprise Server 11 (x86_64)VERSION = 11PATCHLEVEL = 3# Service is running$ /sbin/service boot.kdump statuskdump kernel loaded running# chkconfig shows 'B'$ /sbin/chkconfig boot.kdumpboot.kdump  B# Only appears when --allservices is specified$ /sbin/chkconfig --list | grep kdump$ /sbin/chkconfig --list --allservices | grep kdumpboot.kdump0:off  1:off  2:off  3:off  4:off  5:off  6:off  B:on# Compare with "normal" service$ /sbin/service ntp status...Checking for network time protocol daemon (NTPD):running# chkconfig shows 'on', not 'B'$ /sbin/chkconfig ntpntp  on{code}The provider script ({{puppet/lib/puppet/provider/service/redhat.rb}}) uses the following function to test whether a service is enabled.{code:ruby}  def enabled?name = @resource[:name]begin  output = chkconfig namerescue Puppet::ExecutionFailure  return :falseend# For Suse OS family, chkconfig returns 0 even if the service is disabled or non-existent# Therefore, check the output for '  on' to see if it is enabledreturn :false unless Facter.value(:osfamily) != 'Suse' || output =~ /^#{name}\s+on$/:true  end{code}It accounts for the fact that SLES, unlike RHEL, returns a zero return code in the event that a service is disabled or nonexistent:{code:bash}$ /sbin/chkconfig asdfasdf: unknown service$ echo $?0{code}This doesn't trigger the  `  {{ rescue ` }}  block with its {{false}} return value as a disabled or nonexistent service would for RHEL.So, if the OS family is  not  'Suse' and  we didn't hit the  {{ rescue}} block, it returns {{true}}. If the OS family is 'Suse', {{ output}}  contains  must contain  the service name followed by {{'on'}} ,  in order for  it  returns  to return  {{true}}.  However, as  As  we've seen above, the {{boot.*}} services print an output of {{ B}} and thus return {{false}} even when enabled. 
 
 
 
 
 
 
 
 
 
 
 
 
   

Jira (PUP-8181) break() fails with an illegal context error within an each loop outside any function

2017-11-15 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl created an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8181 
 
 
 
  break() fails with an illegal context error within an each loop outside any function  
 
 
 
 
 
 
 
 
 

Issue Type:
 
  Bug 
 
 
 

Affects Versions:
 

 PUP 4.10.4 
 
 
 

Assignee:
 

 Unassigned 
 
 
 

Components:
 

 Language 
 
 
 

Created:
 

 2017/11/15 4:11 PM 
 
 
 

Priority:
 
  Normal 
 
 
 

Reporter:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 
break() fails with an illegal context error within an each loop outside any function 
 
 
 
 
 
 
$ cat test2.pp 
 
 
 
 
# test.pp 
 
 
 
 
 

Jira (PUP-8181) break() fails with an illegal context error within an each loop outside any function

2017-11-15 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8181 
 
 
 
  break() fails with an illegal context error within an each loop outside any function  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 break() fails with an illegal context error within an each loop outside any function It may be that I simply need to use a function and call it a day... I am, however, surprised that this doesn't work, and I wonder if this is by design or by accident. {code}$ cat test2.pp# test.pp$test_hash = {  'Linus'   => 'Torvalds',  'Richard' => 'Stallman',  'Dennis'  => 'Ritchie',}$test_hash.each |String $first, String $last| {  if $last == 'Stallman' {notice("YES")break()  }  else {notice("NO")  }}{code}{code}$ puppet apply test2.ppNotice: Scope(Class[main]): NONotice: Scope(Class[main]): YESError: break() from context where this is illegal at /tmp/test2.pp:12 on node {code}I've tried the same thing with {{return()}}:{code}$ puppet apply test2.ppNotice: Scope(Class[main]): NONotice: Scope(Class[main]): YESError: return() from context where this is illegal at /tmp/test2.pp:13 on node {code}If I run {{break()}} within a class, I get the same error.If I run {{return()}} within a class, it breaks out of the entire class rather than just the lambda in the {{.each}} loop:{code}$ cat test3.pp# test.ppclass test_class {  $test_hash = {'Linus'   => 'Torvalds','Richard' => 'Stallman','Dennis'  => 'Ritchie',  }  $test_hash.each |String $first, String $last| {if $last == 'Stallman' {  notice("YES")  return()}else {  notice("NO")}  }  notice("OUT OF THE LOOP")}include ::test_class{code}{code}$ puppet apply test3.ppNotice: Scope(Class[Test_class]): NONotice: Scope(Class[Test_class]): YESNotice: Compiled catalog for  in environment production in 0.26 secondsNotice: Applied catalog in 0.45 seconds{code} 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 

Jira (PUP-8181) break() fails with an illegal context error within an each loop outside any function

2017-11-15 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8181 
 
 
 
  break() fails with an illegal context error within an each loop outside any function  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 break() fails with an illegal context error within an each loop outside any functionIt may be that I simply need to use a function and call it a day... I am, however, surprised that this doesn't work, and I wonder if this is by design or by accident.{code}$ cat test2.pp# test.pp$test_hash = {  'Linus'   => 'Torvalds',  'Richard' => 'Stallman',  'Dennis'  => 'Ritchie',}$test_hash.each |String $first, String $last| {  if $last == 'Stallman' {notice("YES")break()  }  else {notice("NO")  }}{code}{code}$ puppet apply test2.ppNotice: Scope(Class[main]): NONotice: Scope(Class[main]): YESError: break() from context where this is illegal at /tmp/test2.pp:12 on node {code}I've tried the same thing with {{return()}}:{code}$ puppet apply test2.ppNotice: Scope(Class[main]): NONotice: Scope(Class[main]): YESError: return() from context where this is illegal at /tmp/test2.pp:13 on node {code}If I run {{break()}} within a class, I get the same error.If I run {{return()}} within a class, it breaks out of the entire class rather than just the lambda in the {{.each}} loop:{code}$ cat test3.pp# test.ppclass test_class {  $test_hash = {'Linus'   => 'Torvalds','Richard' => 'Stallman','Dennis'  => 'Ritchie',  }  $test_hash.each |String $first, String $last| {if $last == 'Stallman' {  notice("YES")  return()}else {  notice("NO")}  }  notice("OUT OF THE LOOP")}include ::test_class{code}{code}$ puppet apply test3.ppNotice: Scope(Class[Test_class]): NONotice: Scope(Class[Test_class]): YESNotice: Compiled catalog for  in environment production in 0.26 secondsNotice: Applied catalog in 0.45 seconds{code}Edit: Issue may be confined to hashes. I'm trying `map` like in the language doc's examples (https://puppet.com/docs/puppet/5.3/function.html#break).{ { code} } $ cat test4.pp# test.ppclass test_class {  $data = [1,2,3]  notice $data.map |$x| {if $x == 3 {  break()}$x*10  }  $data_hash = { 'a' => 1, 'b' => 2, 'c' => 3 }  notice $data_hash.map |$key, $value| {if $value == 3 {  break()}$value*10  }  notice("OUT OF THE LOOP")}include ::test_class{ code} {code} } $ puppet apply test4.ppNotice: Scope(Class[Test_class]): [10, 20]Error: break() from context where this is illegal at /tmp/test4.pp:15 on node { { code} } 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
   

Jira (PUP-8181) break() fails with an illegal context error within an each loop outside any function

2017-11-15 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8181 
 
 
 
  break() fails with an illegal context error within an each loop outside any function  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 break() fails with an illegal context error within an each loop outside any functionIt may be that I simply need to use a function and call it a day... I am, however, surprised that this doesn't work, and I wonder if this is by design or by accident.{code}$ cat test2.pp# test.pp$test_hash = {  'Linus'   => 'Torvalds',  'Richard' => 'Stallman',  'Dennis'  => 'Ritchie',}$test_hash.each |String $first, String $last| {  if $last == 'Stallman' {notice("YES")break()  }  else {notice("NO")  }}{code}{code}$ puppet apply test2.ppNotice: Scope(Class[main]): NONotice: Scope(Class[main]): YESError: break() from context where this is illegal at /tmp/test2.pp:12 on node {code}I've tried the same thing with {{return()}}:{code}$ puppet apply test2.ppNotice: Scope(Class[main]): NONotice: Scope(Class[main]): YESError: return() from context where this is illegal at /tmp/test2.pp:13 on node {code}If I run {{break()}} within a class, I get the same error.If I run {{return()}} within a class, it breaks out of the entire class rather than just the lambda in the {{.each}} loop:{code}$ cat test3.pp# test.ppclass test_class {  $test_hash = {'Linus'   => 'Torvalds','Richard' => 'Stallman','Dennis'  => 'Ritchie',  }  $test_hash.each |String $first, String $last| {if $last == 'Stallman' {  notice("YES")  return()}else {  notice("NO")}  }  notice("OUT OF THE LOOP")}include ::test_class{code}{code}$ puppet apply test3.ppNotice: Scope(Class[Test_class]): NONotice: Scope(Class[Test_class]): YESNotice: Compiled catalog for  in environment production in 0.26 secondsNotice: Applied catalog in 0.45 seconds{code} Edit: Issue may be confined to hashes. I'm trying `map` like in the language doc's examples (https://puppet.com/docs/puppet/5.3/function.html#break).{{code}}$ cat test4.pp# test.ppclass test_class {  $data = [1,2,3]  notice $data.map |$x| {if $x == 3 {  break()}$x*10  }  $data_hash = { 'a' => 1, 'b' => 2, 'c' => 3 }  notice $data_hash.map |$key, $value| {if $value == 3 {  break()}$value*10  }  notice("OUT OF THE LOOP")}include ::test_class{{code}}$ puppet apply test4.ppNotice: Scope(Class[Test_class]): [10, 20]Error: break() from context where this is illegal at /tmp/test4.pp:15 on node {{code}} 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 

Jira (PUP-8181) break() fails with an illegal context error within an each loop outside any function

2017-11-15 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8181 
 
 
 
  break() fails with an illegal context error within an each loop outside any function  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 break() fails with an illegal context error within an each loop outside any functionIt may be that I simply need to use a function and call it a day... I am, however, surprised that this doesn't work, and I wonder if this is by design or by accident.{code}$ cat test2.pp# test.pp$test_hash = {  'Linus'   => 'Torvalds',  'Richard' => 'Stallman',  'Dennis'  => 'Ritchie',}$test_hash.each |String $first, String $last| {  if $last == 'Stallman' {notice("YES")break()  }  else {notice("NO")  }}{code}{code}$ puppet apply test2.ppNotice: Scope(Class[main]): NONotice: Scope(Class[main]): YESError: break() from context where this is illegal at /tmp/test2.pp:12 on node {code}I've tried the same thing with {{return()}}:{code}$ puppet apply test2.ppNotice: Scope(Class[main]): NONotice: Scope(Class[main]): YESError: return() from context where this is illegal at /tmp/test2.pp:13 on node {code}If I run {{break()}} within a class, I get the same error.If I run {{return()}} within a class, it breaks out of the entire class rather than just the lambda in the {{.each}} loop:{code}$ cat test3.pp# test.ppclass test_class {  $test_hash = {'Linus'   => 'Torvalds','Richard' => 'Stallman','Dennis'  => 'Ritchie',  }  $test_hash.each |String $first, String $last| {if $last == 'Stallman' {  notice("YES")  return()}else {  notice("NO")}  }  notice("OUT OF THE LOOP")}include ::test_class{code}{code}$ puppet apply test3.ppNotice: Scope(Class[Test_class]): NONotice: Scope(Class[Test_class]): YESNotice: Compiled catalog for  in environment production in 0.26 secondsNotice: Applied catalog in 0.45 seconds{code}Edit: Issue may be confined to hashes. I'm trying `map` like in the language doc's examples (https://puppet.com/docs/puppet/5.3/function.html#break).  The array example works fine. The hash example breaks. {code}$ cat test4.pp# test.ppclass test_class {  $data = [1,2,3]  notice $data.map |$x| {if $x == 3 {  break()}$x*10  }  $data_hash = { 'a' => 1, 'b' => 2, 'c' => 3 }  notice $data_hash.map |$key, $value| {if $value == 3 {  break()}$value*10  }  notice("OUT OF THE LOOP")}include ::test_class{code}{code}$ puppet apply test4.ppNotice: Scope(Class[Test_class]): [10, 20]Error: break() from context where this is illegal at /tmp/test4.pp:15 on node {code} 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 

Jira (PUP-8181) break() fails with illegal context error within a loop over a hash outside any function

2017-11-15 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8181 
 
 
 
  break() fails with illegal context error within a loop over a hash outside any function  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 

Summary:
 
 break() fails with  an  illegal context error within  an each  a  loop  over a hash  outside any function 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-8181) break() fails with illegal context error within a loop over a hash outside any function

2017-11-15 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8181 
 
 
 
  break() fails with illegal context error within a loop over a hash outside any function  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 break() fails with an illegal context error within an each loop outside any functionIt may be that I simply need to use a function and call it a day... I am, however, surprised that this doesn't work, and I wonder if this is by design or by accident.{code}$ cat test2.pp# test.pp$test_hash = {  'Linus'   => 'Torvalds',  'Richard' => 'Stallman',  'Dennis'  => 'Ritchie',}$test_hash.each |String $first, String $last| {  if $last == 'Stallman' {notice("YES")break()  }  else {notice("NO")  }}{code}{code}$ puppet apply test2.ppNotice: Scope(Class[main]): NONotice: Scope(Class[main]): YESError: break() from context where this is illegal at /tmp/test2.pp:12 on node {code}I've tried the same thing with {{return()}}:{code}$ puppet apply test2.ppNotice: Scope(Class[main]): NONotice: Scope(Class[main]): YESError: return() from context where this is illegal at /tmp/test2.pp:13 on node {code}If I run {{break()}} within a class, I get the same error.If I run {{return()}} within a class, it breaks out of the entire class rather than just the lambda in the {{.each}} loop:{code}$ cat test3.pp# test.ppclass test_class {  $test_hash = {'Linus'   => 'Torvalds','Richard' => 'Stallman','Dennis'  => 'Ritchie',  }  $test_hash.each |String $first, String $last| {if $last == 'Stallman' {  notice("YES")  return()}else {  notice("NO")}  }  notice("OUT OF THE LOOP")}include ::test_class{code}{code}$ puppet apply test3.ppNotice: Scope(Class[Test_class]): NONotice: Scope(Class[Test_class]): YESNotice: Compiled catalog for  in environment production in 0.26 secondsNotice: Applied catalog in 0.45 seconds{code}Edit: Issue may be confined to hashes. I'm trying `map` like in the language doc's examples (https://puppet.com/docs/puppet/5.3/function.html#break). The array example works fine. The hash example breaks.{code}$ cat test4.pp# test.ppclass test_class {  $data = [1,2,3]  notice $data.map |$x| {if $x == 3 {  break()}$x*10  }  $data_hash = { 'a' => 1, 'b' => 2, 'c' => 3 }  notice $data_hash.map |$key, $value| {if $value == 3 {  break()}$value*10  }  notice("OUT OF THE LOOP")}include ::test_class{code}{code}$ puppet apply test4.ppNotice: Scope(Class[Test_class]): [10, 20]Error: break() from context where this is illegal at /tmp/test4.pp:15 on node {code} Example of a workaround using a function and {{return()}}:{code}$ cat test5.pp# test.ppfunction has_two($data) {  $data.each |$key, $value| {if $value == 2 {  return(true)}  }  return(false)}$data = { 'a' => 1, 'b' => 2, 'c' => 3 }if has_two($data) {  notice "YES"}else {  notice "NO"}{code}{code}$ puppet apply test5.ppNotice: Scope(Class[main]): YESNotice: Compiled catalog for  in environment production in 0.16 secondsNotice: Applied catalog in 0.49 seconds{code} 
 
 
 
 
 
 
 
 
 

Jira (PUP-8181) break() fails with illegal context error within a loop over a hash outside any function

2017-11-16 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8181 
 
 
 
  break() fails with illegal context error within a loop over a hash outside any function  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 break() fails with an illegal context error within  an each loop  hash iteration  outside any functionIt may be that I simply need to use a function and call it a day... I am, however, surprised that this doesn't work, and I wonder if this is by design or by accident.{code}$ cat test2.pp# test.pp$test_hash = {  'Linus'   => 'Torvalds',  'Richard' => 'Stallman',  'Dennis'  => 'Ritchie',}$test_hash.each |String $first, String $last| {  if $last == 'Stallman' {notice("YES")break()  }  else {notice("NO")  }}{code}{code}$ puppet apply test2.ppNotice: Scope(Class[main]): NONotice: Scope(Class[main]): YESError: break() from context where this is illegal at /tmp/test2.pp:12 on node {code}I've tried the same thing with {{return()}}:{code}$ puppet apply test2.ppNotice: Scope(Class[main]): NONotice: Scope(Class[main]): YESError: return() from context where this is illegal at /tmp/test2.pp:13 on node {code}If I run {{break()}} within a class, I get the same error.If I run {{return()}} within a class, it breaks out of the entire class rather than just the lambda in the {{.each}} loop:{code}$ cat test3.pp# test.ppclass test_class {  $test_hash = {'Linus'   => 'Torvalds','Richard' => 'Stallman','Dennis'  => 'Ritchie',  }  $test_hash.each |String $first, String $last| {if $last == 'Stallman' {  notice("YES")  return()}else {  notice("NO")}  }  notice("OUT OF THE LOOP")}include ::test_class{code}{code}$ puppet apply test3.ppNotice: Scope(Class[Test_class]): NONotice: Scope(Class[Test_class]): YESNotice: Compiled catalog for  in environment production in 0.26 secondsNotice: Applied catalog in 0.45 seconds{code}Edit: Issue may be confined to hashes. I'm trying `map` like in the language doc's examples (https://puppet.com/docs/puppet/5.3/function.html#break). The array example works fine. The hash example breaks.{code}$ cat test4.pp# test.ppclass test_class {  $data = [1,2,3]  notice $data.map |$x| {if $x == 3 {  break()}$x*10  }  $data_hash = { 'a' => 1, 'b' => 2, 'c' => 3 }  notice $data_hash.map |$key, $value| {if $value == 3 {  break()}$value*10  }  notice("OUT OF THE LOOP")}include ::test_class{code}{code}$ puppet apply test4.ppNotice: Scope(Class[Test_class]): [10, 20]Error: break() from context where this is illegal at /tmp/test4.pp:15 on node {code}Example of a workaround using a function and {{return()}}:{code}$ cat test5.pp# test.ppfunction has_two($data) {  $data.each |$key, $value| {if $value == 2 {  return(true)}  }  return(false)}$data = { 'a' => 1, 'b' => 2, 'c' => 3 }if has_two($data) {  notice "YES"}else {  notice "NO"}{code}{code}$ puppet apply test5.ppNotice: Scope(Class[main]): YESNotice: Compiled catalog for  in environment production in 0.16 secondsNotice: Applied catalog in 0.49 seconds{code} 
 
 
 
 
 
 
 
 
 

Jira (PUP-8181) break() fails with illegal context error within hash iteration outside any function

2017-11-16 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8181 
 
 
 
  break() fails with illegal context error within hash iteration outside any function  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 

Summary:
 
 break() fails with illegal context error within  a loop over a  hash  iteration  outside any function 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-8181) break() fails with illegal context error within hash iteration outside any function

2017-11-17 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-8181 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: break() fails with illegal context error within hash iteration outside any function  
 
 
 
 
 
 
 
 
 
 
The direct error is coming from eval_Program in evaluator_impl.rb. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-8181) break() fails with illegal context error within hash iteration outside any function

2017-11-17 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-8181 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: break() fails with illegal context error within hash iteration outside any function  
 
 
 
 
 
 
 
 
 
 
A hash doesn't rescue a `StopIteration` exception as an array does. There may very well be good reasons for this and maybe we can't simply go change the behavior. But using `each` loops as an example: 
each.rb: 
 
 
 
 
 
 
  def foreach_Hash_1(hash) 
 
 
 
 
enumerator = hash.each_pair 
 
 
 
 
hash.size.times do 
 
 
 
 
  yield(enumerator.next) 
 
 
 
 
end 
 
 
 
 
# produces the receiver 
 
 
 
 
hash 
 
 
 
 
  end 
 
 
 
 
  
 
 
 
 
  def foreach_Hash_2(hash) 
 
 
 

Jira (PUP-8181) break() fails with illegal context error within hash iteration outside any function

2017-11-17 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8181 
 
 
 
  break() fails with illegal context error within hash iteration outside any function  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 break() fails with an illegal context error within hash iteration outside any functionIt may be that I simply need to use a function and call it a day... I am, however, surprised that this doesn't work, and I wonder if this is by design or by accident.{code :puppet } $ cat #  test2.pp # test.pp   $test_hash = {  'Linus'   => 'Torvalds',  'Richard' => 'Stallman',  'Dennis'  => 'Ritchie',}$test_hash.each |String $first, String $last| {  if $last == 'Stallman' {notice("YES")break()  }  else {notice("NO")  }}{code}{code :bash }$ puppet apply test2.ppNotice: Scope(Class[main]): NONotice: Scope(Class[main]): YESError: break() from context where this is illegal at /tmp/test2.pp:12 on node {code}I've tried the same thing with {{return()}}:{code :bash }$ puppet apply test2.ppNotice: Scope(Class[main]): NONotice: Scope(Class[main]): YESError: return() from context where this is illegal at /tmp/test2.pp:13 on node {code}If I run {{break()}} within a class, I get the same error.If I run {{return()}} within a class, it breaks out of the entire class rather than just the lambda in the {{.each}} loop:{code :puppet } $ cat #  test3.pp # test.pp   class test_class {  $test_hash = {'Linus'   => 'Torvalds','Richard' => 'Stallman','Dennis'  => 'Ritchie',  }  $test_hash.each |String $first, String $last| {if $last == 'Stallman' {  notice("YES")  return()}else {  notice("NO")}  }  notice("OUT OF THE LOOP")}include ::test_class{code}{code :bash }$ puppet apply test3.ppNotice: Scope(Class[Test_class]): NONotice: Scope(Class[Test_class]): YESNotice: Compiled catalog for  in environment production in 0.26 secondsNotice: Applied catalog in 0.45 seconds{code}Edit: Issue may be confined to hashes. I'm trying `map` like in the language doc's examples (https://puppet.com/docs/puppet/5.3/function.html#break). The array example works fine. The hash example breaks.{code :bash } $ cat #  test4.pp # test.pp   class test_class {  $data = [1,2,3]  notice $data.map |$x| {if $x == 3 {  break()}$x*10  }  $data_hash = { 'a' => 1, 'b' => 2, 'c' => 3 }  notice $data_hash.map |$key, $value| {if $value == 3 {  break()}$value*10  }  notice("OUT OF THE LOOP")}include ::test_class{code}{code :bash }$ puppet apply test4.ppNotice: Scope(Class[Test_class]): [10, 20]Error: break() from context where this is illegal at /tmp/test4.pp:15 on node {code}Example of a workaround using a function and {{return()}}:{code :puppet } $ cat #  test5.pp # test.pp function has_two($data) {  $data.each |$key, $value| {if $value == 2 {  return(true)}  }  return(false)}$data = { 'a' => 1, 'b' => 2, 'c' => 3 }if has_two($data) {  notice "YES"}else {  notice "NO"}{code}{code}$ puppet apply test5.ppNotice: Scope(Class[main]): YESNotice: Compiled catalog for  in environment production in 0.16 secondsNotice: Applied catalog in 0.49 seconds{code} 
 
 
 
 
 
 
 

Jira (PUP-8181) break() fails with illegal context error within hash iteration outside any function

2017-11-17 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8181 
 
 
 
  break() fails with illegal context error within hash iteration outside any function  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 break() fails with an illegal context error within hash iteration outside any functionIt may be that I simply need to use a function and call it a day... I am, however, surprised that this doesn't work, and I wonder if this is by design or by accident.{code:puppet}# test2.pp$test_hash = {  'Linus'   => 'Torvalds',  'Richard' => 'Stallman',  'Dennis'  => 'Ritchie',}$test_hash.each |String $first, String $last| {  if $last == 'Stallman' {notice("YES")break()  }  else {notice("NO")  }}{code}{code:bash}$ puppet apply test2.ppNotice: Scope(Class[main]): NONotice: Scope(Class[main]): YESError: break() from context where this is illegal at /tmp/test2.pp:12 on node {code}I've tried the same thing with {{return()}}:{code:bash}$ puppet apply test2.ppNotice: Scope(Class[main]): NONotice: Scope(Class[main]): YESError: return() from context where this is illegal at /tmp/test2.pp:13 on node {code}If I run {{break()}} within a class, I get the same error.If I run {{return()}} within a class, it breaks out of the entire class rather than just the lambda in the {{.each}} loop:{code:puppet}# test3.ppclass test_class {  $test_hash = {'Linus'   => 'Torvalds','Richard' => 'Stallman','Dennis'  => 'Ritchie',  }  $test_hash.each |String $first, String $last| {if $last == 'Stallman' {  notice("YES")  return()}else {  notice("NO")}  }  notice("OUT OF THE LOOP")}include ::test_class{code}{code:bash}$ puppet apply test3.ppNotice: Scope(Class[Test_class]): NONotice: Scope(Class[Test_class]): YESNotice: Compiled catalog for  in environment production in 0.26 secondsNotice: Applied catalog in 0.45 seconds{code}Edit: Issue may be confined to hashes. I'm trying `map` like in the language doc's examples (https://puppet.com/docs/puppet/5.3/function.html#break). The array example works fine. The hash example breaks.{code:bash}# test4.ppclass test_class {  $data = [1,2,3]  notice $data.map |$x| {if $x == 3 {  break()}$x*10  }  $data_hash = { 'a' => 1, 'b' => 2, 'c' => 3 }  notice $data_hash.map |$key, $value| {if $value == 3 {  break()}$value*10  }  notice("OUT OF THE LOOP")}include ::test_class{code}{code:bash}$ puppet apply test4.ppNotice: Scope(Class[Test_class]): [10, 20]Error: break() from context where this is illegal at /tmp/test4.pp:15 on node {code}Example of a workaround using a function and {{return()}}:{code:puppet}# test5.ppfunction has_two($data) {  $data.each |$key, $value| {if $value == 2 {  return(true)}  }  return(false)}$data = { 'a' => 1, 'b' => 2, 'c' => 3 }if has_two($data) {  notice "YES"}else {  notice "NO"}{code}{code :bash }$ puppet apply test5.ppNotice: Scope(Class[main]): YESNotice: Compiled catalog for  in environment production in 0.16 secondsNotice: Applied catalog in 0.49 seconds{code} 
 
 
 
 
 
 
 
 
 
  

Jira (PUP-8181) break() fails with illegal context error within hash iteration outside any function

2017-11-18 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-8181 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: break() fails with illegal context error within hash iteration outside any function  
 
 
 
 
 
 
 
 
 
 
Submitted PR that appears to fix this bug. I am very much open to feedback from Engineering in case there are unforeseen side effects or a better, more complete solution. 
https://github.com/puppetlabs/puppet/pull/6374 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-6038) Puppet sets GID

2017-11-19 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-6038 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Puppet sets GID  
 
 
 
 
 
 
 
 
 
 
Moses Mendoza Is that not the expected behavior? I would think that the all = read permission (rather than all + read) coming at the end would override the user and group permissions set in the first and second positions. It's setting absolute permissions for all users rather than ensuring that the read permission is present (a+r) or ensuring that it's absent (a-r). 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-6038) Puppet sets GID

2017-11-19 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-6038 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Puppet sets GID  
 
 
 
 
 
 
 
 
 
 
As it stands, I'm using Fedora 26 with Puppet 5.3.3 and am not able to reproduce there. Perhaps this was resolved in Puppet 4 or 5? 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-7686) puppet apply --help doesn't show configprint option

2017-11-19 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-7686 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: puppet apply --help doesn't show configprint option  
 
 
 
 
 
 
 
 
 
 
This option is already documented. `puppet help apply` tells us: 
 
 
 
 
 
 
OPTIONS 
 
 
 
 
--- 
 
 
 
 
Note that any setting that's valid in the configuration 
 
 
 
 
file is also a valid long argument. For example, 'tags' is a 
 
 
 
 
valid setting, so you can specify '--tags ,' 
 
 
 
 
as an argument. 
 
 
 
 
  
 
 
 
 
See the configuration file documentation at 
 
 
 
 
https://docs.puppetlabs.com/puppet/latest/reference/configuration.html for the 
 
 
 
 
full list of acceptable parameters. A commented list of all 
 
 
 
  

Jira (PUP-7728) cron deleting not managed lines

2017-11-19 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-7728 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: cron deleting not managed lines  
 
 
 
 
 
 
 
 
 
 
I can definitely see the logic for how it behaves now, and some code may depend on this behavior. It's hard for me to think of a real-life use case though for someone commenting out the Puppet-managed cron job and then expecting Puppet to manage or insert a cron job on the line below it. I'm curious to hear what engineering thinks. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-7131) cron resource: Do not restrict time parameters to integers

2017-11-19 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-7131 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: cron resource: Do not restrict time parameters to integers  
 
 
 
 
 
 
 
 
 
 
otheus Can you please confirm whether this bug is still present? From what I can see the documentation now reflects the various usage options, and I'm not able to reproduce a problem: 
 
 
 
 
 
 
# test.pp 
 
 
 
 
  
 
 
 
 
cron { 'test1': 
 
 
 
 
  command => '/usr/sbin/test1', 
 
 
 
 
  user=> 'reid', 
 
 
 
 
  hour=> 2, 
 
 
 
 
  minute  => 3, 
 
 
 
 
} 
 
 
 
 
  
 
 
 
 
cron { 'test2': 
 
 
 
 
  command => '/usr/sbin/test

Jira (PUP-6635) An exec resource specifying a user will not inherit that user's limits from /etc/security/limits.conf

2017-11-19 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-6635 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: An exec resource specifying a user will not inherit that user's limits from /etc/security/limits.conf  
 
 
 
 
 
 
 
 
 
 
We can trace the implementation of exec with a user attribute set, all the way down to the Ruby Process::UID.change_privileges method: 
From exec.rb: 
 
 
 
 
 
 
  output = Puppet::Util::Execution.execute(command, :failonfail => false, :combine => true, 
 
 
 
 
  :uid => resource[:user], :gid => resource[:group], 
 
 
 
 
  :override_locale => false, 
 
 
 
 
  :custom_environment => environment, 
 
 
 
 
  :sensitive => sensitive)
 
 
 
 
 
 
 
From execution.rb's execute: 
 
 
 
 
 
 
  elsif Puppet.features.posix? 
 
 
 
 
child_pid = nil 
 
 
 
 
begin 
 
 

Jira (PUP-6635) An exec resource specifying a user will not inherit that user's limits from /etc/security/limits.conf

2017-11-19 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-6635 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: An exec resource specifying a user will not inherit that user's limits from /etc/security/limits.conf  
 
 
 
 
 
 
 
 
 
 
Heheheh... 
 
 
 
 
 
 
require File.expand_path('../../../../spec_helper', __FILE__) 
 
 
 
 
  
 
 
 
 
describe "Process::UID.change_privilege" do 
 
 
 
 
  it "needs to be reviewed for spec completeness" 
 
 
 
 
end
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 

Jira (PUP-6635) An exec resource specifying a user will not inherit that user's limits from /etc/security/limits.conf

2017-11-20 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-6635 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: An exec resource specifying a user will not inherit that user's limits from /etc/security/limits.conf  
 
 
 
 
 
 
 
 
 
 
Hmm. I missed the provider => shell til now. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-6635) An exec resource specifying a user will not inherit that user's limits from /etc/security/limits.conf

2017-11-20 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-6635 
 
 
 
  An exec resource specifying a user will not inherit that user's limits from /etc/security/limits.conf  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 

Comment:
 
 Hmm. I missed the {{provider => shell}} til now. Not familiar enough with Ruby to recognize right away how this comes into play and whether the Ruby Process::UID method is still being called, but I believe it is. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-6635) An exec resource specifying a user will not inherit that user's limits from /etc/security/limits.conf

2017-11-20 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-6635 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: An exec resource specifying a user will not inherit that user's limits from /etc/security/limits.conf  
 
 
 
 
 
 
 
 
 
 
Launched /bin/sleep 120 as user test2 via exec and via sudo -u. The process of the sleep launched via Puppet AND its parent (ruby-mri) have the root user's ulimits. The sleep process launched via sudo AND its parent (sudo) have the test2 user's ulimits. 
 
 
 
 
 
 
[root@laptop /proc]# ps -eo euser,pid,ppid,ruser,suser,fuser,f,comm,label | awk '$1 == "test2" || $2 ~ /15298|15063/' 
 
 
 
 
root 15063 15062 root root root 4 ruby-mriunconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 
 
 
 
 
root 15298 12982 root root root 4 sudounconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 
 
 
 
 
test215304 15298 test2test2test24 sleep   unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 
 
 
 
 
test215452 15063 test2test2test24 sleep   unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 
 
 
 
 
  
 
 
 
 
[root@laptop /proc]# grep 'open files' {15063,15298,15304,15452}/limits 
 
 
 
 
15063/limits:Max open files1024 4096 files  
 
 
 

Jira (PUP-6635) An exec resource specifying a user will not inherit that user's limits from /etc/security/limits.conf

2017-11-20 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-6635 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: An exec resource specifying a user will not inherit that user's limits from /etc/security/limits.conf  
 
 
 
 
 
 
 
 
 
 
I think it's doable but will require separate calls to Process.setrlimit() after first determining the rlimits of the user we're trying to execute the command as. This is new to me and I have an actual job so someone else might beat me to getting this one sorted out... I welcome it. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-7937) extra "." or missing "." in csr message

2017-11-20 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-7937 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: extra "." or missing "." in csr message  
 
 
 
 
 
 
 
 
 
 
PR https://github.com/puppetlabs/puppet/pull/6375 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-8187) `puppet master compile` fails to save the catalog with arbitrary binary data in file resources

2017-11-20 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-8187 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: `puppet master compile` fails to save the catalog with arbitrary binary data in file resources  
 
 
 
 
 
 
 
 
 
 
Would it be possible to post a reproducer? Trying to think of the best way to go about testing this based on what you've said in Slack. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-8187) `puppet master compile` fails to save the catalog with arbitrary binary data in file resources

2017-11-20 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-8187 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: `puppet master compile` fails to save the catalog with arbitrary binary data in file resources  
 
 
 
 
 
 
 
 
 
 
Reproduced. 
For what it's worth, one of my first thoughts is that the previously working behavior may have been unintended and "use at your own risk." The content property is supposed to receive a string. I don't know if a binary file content counts as a string. 
That hypothesis is somewhat complicated by this block in content.rb: 
 
 
 
 
 
 
# Store a checksum as the value, rather than the actual content. 
 
 
 
 
# Simplifies everything. 
 
 
 
 
munge do |value| 
 
 
 
 
  if value == :absent 
 
 
 
 
value 
 
 
 
 
  elsif value.is_a?(String) && checksum?(value) 
 
 
 
 
# XXX This is potentially dangerous because it means users can't write a file whose 
 
 
 
 
# entire contents are a plain checksum unless it is a Binary content. 
 
 
 
 
value 
 
   

Jira (PUP-8187) `puppet master compile` fails to save the catalog with arbitrary binary data in file resources

2017-11-20 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-8187 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: `puppet master compile` fails to save the catalog with arbitrary binary data in file resources  
 
 
 
 
 
 
 
 
 
 
Ping Josh Cooper Moses Mendoza, re: https://github.com/puppetlabs/puppet/pull/5782 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-8187) `puppet master compile` fails to save the catalog with arbitrary binary data in file resources

2017-11-20 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-8187 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: `puppet master compile` fails to save the catalog with arbitrary binary data in file resources  
 
 
 
 
 
 
 
 
 
 
Johnson Earls, in your use case, could you use both the source property and the content property (setting the one you're not using to undef), and avoid the whole issue by source-ing the non-template files? 
 
 
 
 
 
 
[reid@laptop ~/git/puppet/lib/puppet/resource]$ ll /tmp/content.txt /tmp/dest.txt 
 
 
 
 
ls: cannot access '/tmp/content.txt': No such file or directory 
 
 
 
 
ls: cannot access '/tmp/dest.txt': No such file or directory 
 
 
 
 
  
 
 
 
 
[reid@laptop ~/git/puppet/lib/puppet/resource]$ cat /tmp/content.pp  
 
 
 
 
# content.pp 
 
 
 
 
  
 
 
 
 
file { '/tmp/content.txt': 
 
 
 
 
  ensure  => file, 
 
 
 
 
  source  => undef, 

Jira (PUP-8192) call_function() documentation incorrect on 'Writing functions in Ruby'

2017-11-21 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl created an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8192 
 
 
 
  call_function() documentation incorrect on 'Writing functions in Ruby'  
 
 
 
 
 
 
 
 
 

Issue Type:
 
  Bug 
 
 
 

Affects Versions:
 

 PUP 4.10.4 
 
 
 

Assignee:
 

 Unassigned 
 
 
 

Components:
 

 DOCS 
 
 
 

Created:
 

 2017/11/21 11:55 PM 
 
 
 

Priority:
 
  Normal 
 
 
 

Reporter:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 
The documentation for writing custom functions in Ruby states that the second argument to call_function is an array containing all arguments that will be passed to the function being called. 
>If you want to call another Puppet function (like include) from inside a function, use the special call_function(name, args, &block) method. 
># Flatten an array of arrays of strings, then pass it to include: >def include_nested(array_of_arrays) > call_function('include', array_of_arrays.flatten) >end >The first argument must be the name of the function to call, as a string. >The second argument must be an array containing any arguments to the function. >The third argument can be a Ruby Proc, or a Puppet lambda previously captured as a Proc (see above). You can also provide a block of Ruby code using the normal block syntax. >def my_function1(a, b, &block) > # passing given Proc > call_function('my_other_function', [a, b], &block) >end 
>de

Jira (PUP-8192) call_function() documentation incorrect on 'Writing functions in Ruby'

2017-11-21 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8192 
 
 
 
  call_function() documentation incorrect on 'Writing functions in Ruby'  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 The documentation for writing custom functions in Ruby states that the second argument to {{call_function}} is an array containing all arguments that will be passed to the function being called.>If you want to call another Puppet function (like include) from inside a function, use the special call_function(name, args, &block) method.># Flatten an array of arrays of strings, then pass it to include:>def include_nested(array_of_arrays)>  call_function('include', array_of_arrays.flatten)>end>The first argument must be the name of the function to call, as a string.>The second argument must be an array containing any arguments to the function.>The third argument can be a Ruby Proc, or a Puppet lambda previously captured as a Proc (see above). You can also provide a block of Ruby code using the normal block syntax.>def my_function1(a, b, &block)>  # passing given Proc>  call_function('my_other_function', [a, b], &block)>end>def my_function2(a, b)>  # using a Ruby block>  call_function('my_other_function', [a, b]) { |x| ... }>endSource: https://puppet.com/docs/puppet/5.3/functions_ruby_implementation.html#calling-other-functionsIn my experience, this is not accurate. Attempts to pass an array of arguments in the second position consistently failed. Details: https://gist.github.com/nrwahl2/2d580fd564794da8a685f1a965d832f9To summarize, what I tried to do is:{code:ruby}kernel_modules = scope['facts']['kernel_modules']builtin_kmods = call_function('get_builtin_kmods', [kernel_modules]){code}The error I received is:{code}Evaluation Error: Error while evaluating a Function Call, 'get_builtin_kmods' parameter 'kernel_modules' expects a Hash value, got Tuple{code}{{$facts['kernel_modules']}} is a custom fact containing a {{Hash[String, String]}} value. Based on the documentation, my call to {{call_function()}} should have sent a one-element array of arguments to the {{get_builtin_kmods}} function. Instead, it sent one argument, which was a one-element array.It worked as expected when I removed the square brackets and used{code:ruby}builtin_kmods = call_function('get_builtin_kmods', kernel_modules){code}Based on this and on examples from stdlib, it seems that this implementation of {{call_function()}} takes a sequence of arguments corresponding one-to-one to what gets passed to the called function, rather than taking an array each element of which gets passed to the called function.{code}stdlib/lib/puppet/functions/validate_legacy.rb:call_function('deprecation', 'validate_legacy', error_msg)stdlib/lib/puppet/functions/validate_legacy.rb:call_function('fail', error_msg)stdlib/lib/puppet/functions/validate_ip_address.rb:call_function('deprecation', 'validate_ip_address', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Ip_Address. There is further documentation for validate_legacy function in the README.")stdlib/lib/puppet/functions/is_string.rb:call_function('deprecation', 'is_string', "This method is deprecated, please use match expressions with Stdlib::Compat::String instead. They are described at https://docs.puppet.com/puppet

Jira (PUP-8192) call_function() documentation incorrect on 'Writing functions in Ruby'

2017-11-21 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8192 
 
 
 
  call_function() documentation incorrect on 'Writing functions in Ruby'  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 The documentation for writing custom functions in Ruby states that the second argument to {{call_function}} is an array containing all arguments that will be passed to the function being called. > {quote}  If you want to call another Puppet function (like include) from inside a function, use the special call_function(name, args, &block) method. >  # Flatten an array of arrays of strings, then pass it to include: >  def include_nested(array_of_arrays) >    call_function('include', array_of_arrays.flatten) >  end >  The first argument must be the name of the function to call, as a string. >  The second argument must be an array containing any arguments to the function. >  The third argument can be a Ruby Proc, or a Puppet lambda previously captured as a Proc (see above). You can also provide a block of Ruby code using the normal block syntax. >  def my_function1(a, b, &block) >    # passing given Proc >    call_function('my_other_function', [a, b], &block) >  end >  def my_function2(a, b) >    # using a Ruby block >    call_function('my_other_function', [a, b]) { |x| ... } >  end {quote}   Source: https://puppet.com/docs/puppet/5.3/functions_ruby_implementation.html#calling-other-functionsIn my experience, this is not accurate. Attempts to pass an array of arguments in the second position consistently failed. Details: https://gist.github.com/nrwahl2/2d580fd564794da8a685f1a965d832f9To summarize, what I tried to do is:{code:ruby}kernel_modules = scope['facts']['kernel_modules']builtin_kmods = call_function('get_builtin_kmods', [kernel_modules]){code}The error I received is:{code}Evaluation Error: Error while evaluating a Function Call, 'get_builtin_kmods' parameter 'kernel_modules' expects a Hash value, got Tuple{code}{{$facts['kernel_modules']}} is a custom fact containing a {{Hash[String, String]}} value. Based on the documentation, my call to {{call_function()}} should have sent a one-element array of arguments to the {{get_builtin_kmods}} function. Instead, it sent one argument, which was a one-element array.It worked as expected when I removed the square brackets and used{code:ruby}builtin_kmods = call_function('get_builtin_kmods', kernel_modules){code}Based on this and on examples from stdlib, it seems that this implementation of {{call_function()}} takes a sequence of arguments corresponding one-to-one to what gets passed to the called function, rather than taking an array each element of which gets passed to the called function.{code}stdlib/lib/puppet/functions/validate_legacy.rb:call_function('deprecation', 'validate_legacy', error_msg)stdlib/lib/puppet/functions/validate_legacy.rb:call_function('fail', error_msg)stdlib/lib/puppet/functions/validate_ip_address.rb:call_function('deprecation', 'validate_ip_address', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Ip_Address. There is further documentation for validate_legacy function in the README.")stdlib/lib/puppet/functions/is_string.rb:call_function('deprecation', 'is_string', "This method is deprecated, please use match expressions with Stdlib::Compat::S

Jira (PUP-8192) call_function() documentation incorrect on 'Writing functions in Ruby'

2017-11-21 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8192 
 
 
 
  call_function() documentation incorrect on 'Writing functions in Ruby'  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 

Affects Version/s:
 
 PUP 5.3.3 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-8192) call_function() documentation incorrect on 'Writing functions in Ruby'

2017-11-22 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8192 
 
 
 
  call_function() documentation incorrect on 'Writing functions in Ruby'  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 The documentation for writing custom functions in Ruby states that the second argument to {{call_function}} is an array containing all arguments that will be passed to the function being called.{quote}If you want to call another Puppet function (like include) from inside a function, use the special call_function(name, args, &block) method.# Flatten an array of arrays of strings, then pass it to include:def include_nested(array_of_arrays)  call_function('include', array_of_arrays.flatten)endThe first argument must be the name of the function to call, as a string.The second argument must be an array containing any arguments to the function.The third argument can be a Ruby Proc, or a Puppet lambda previously captured as a Proc (see above). You can also provide a block of Ruby code using the normal block syntax.def my_function1(a, b, &block)  # passing given Proc  call_function('my_other_function', [a, b], &block)enddef my_function2(a, b)  # using a Ruby block  call_function('my_other_function', [a, b]) { |x| ... }end{quote} Source: ??  https://puppet.com/docs/puppet/5.3/functions_ruby_implementation.html#calling-other-functions ?? In my experience, this is not accurate. Attempts to pass an array of arguments in the second position consistently failed. Details: https://gist.github.com/nrwahl2/2d580fd564794da8a685f1a965d832f9To summarize, what I tried to do is:{code:ruby}kernel_modules = scope['facts']['kernel_modules']builtin_kmods = call_function('get_builtin_kmods', [kernel_modules]){code}The error I received is:{code}Evaluation Error: Error while evaluating a Function Call, 'get_builtin_kmods' parameter 'kernel_modules' expects a Hash value, got Tuple{code}{{$facts['kernel_modules']}} is a custom fact containing a {{Hash[String, String]}} value. Based on the documentation, my call to {{call_function()}} should have sent a one-element array of arguments to the {{get_builtin_kmods}} function. Instead, it sent one argument, which was a one-element array.It worked as expected when I removed the square brackets and used{code:ruby}builtin_kmods = call_function('get_builtin_kmods', kernel_modules){code}Based on this and on examples from stdlib, it seems that this implementation of {{call_function()}} takes a sequence of arguments corresponding one-to-one to what gets passed to the called function, rather than taking an array each element of which gets passed to the called function.{code}stdlib/lib/puppet/functions/validate_legacy.rb:call_function('deprecation', 'validate_legacy', error_msg)stdlib/lib/puppet/functions/validate_legacy.rb:call_function('fail', error_msg)stdlib/lib/puppet/functions/validate_ip_address.rb:call_function('deprecation', 'validate_ip_address', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Ip_Address. There is further documentation for validate_legacy function in the README.")stdlib/lib/puppet/functions/is_string.rb:call_function('deprecation', 'is_string', "This method is deprecated, please use match expressions with Stdlib::Compat::String instead. They are described at https://docs.puppet.com

Jira (PUP-8192) call_function() documentation incorrect on 'Writing functions in Ruby'

2017-11-22 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8192 
 
 
 
  call_function() documentation incorrect on 'Writing functions in Ruby'  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 The documentation for writing custom functions in Ruby states that the second argument to {{call_function}} is an array containing all arguments that will be passed to the function being called.{quote}If you want to call another Puppet function (like include) from inside a function, use the special call_function(name, args, &block) method.# Flatten an array of arrays of strings, then pass it to include:def include_nested(array_of_arrays)  call_function('include', array_of_arrays.flatten)endThe first argument must be the name of the function to call, as a string.The second argument must be an array containing any arguments to the function.The third argument can be a Ruby Proc, or a Puppet lambda previously captured as a Proc (see above). You can also provide a block of Ruby code using the normal block syntax.def my_function1(a, b, &block)  # passing given Proc  call_function('my_other_function', [a, b], &block)enddef my_function2(a, b)  # using a Ruby block  call_function('my_other_function', [a, b]) { |x| ... }end{quote}??  Source:  https://puppet.com/docs/puppet/5.3/functions_ruby_implementation.html#calling-other-functions ??In my experience, this is not accurate. Attempts to pass an array of arguments in the second position consistently failed. Details: https://gist.github.com/nrwahl2/2d580fd564794da8a685f1a965d832f9To summarize, what I tried to do is:{code:ruby}kernel_modules = scope['facts']['kernel_modules']builtin_kmods = call_function('get_builtin_kmods', [kernel_modules]){code}The error I received is:{code}Evaluation Error: Error while evaluating a Function Call, 'get_builtin_kmods' parameter 'kernel_modules' expects a Hash value, got Tuple{code}{{$facts['kernel_modules']}} is a custom fact containing a {{Hash[String, String]}} value. Based on the documentation, my call to {{call_function()}} should have sent a one-element array of arguments to the {{get_builtin_kmods}} function. Instead, it sent one argument, which was a one-element array.It worked as expected when I removed the square brackets and used{code:ruby}builtin_kmods = call_function('get_builtin_kmods', kernel_modules){code}Based on this and on examples from stdlib, it seems that this implementation of {{call_function()}} takes a sequence of arguments corresponding one-to-one to what gets passed to the called function, rather than taking an array each element of which gets passed to the called function.{code}stdlib/lib/puppet/functions/validate_legacy.rb:call_function('deprecation', 'validate_legacy', error_msg)stdlib/lib/puppet/functions/validate_legacy.rb:call_function('fail', error_msg)stdlib/lib/puppet/functions/validate_ip_address.rb:call_function('deprecation', 'validate_ip_address', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Ip_Address. There is further documentation for validate_legacy function in the README.")stdlib/lib/puppet/functions/is_string.rb:call_function('deprecation', 'is_string', "This method is deprecated, please use match expressions with Stdlib::Compat::String instead. They are described at https://docs.puppet.com/

Jira (PUP-8192) call_function() documentation incorrect on 'Writing functions in Ruby'

2017-11-22 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8192 
 
 
 
  call_function() documentation incorrect on 'Writing functions in Ruby'  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 The documentation for writing custom functions in Ruby states that the second argument to {{call_function}} is an array containing all arguments that will be passed to the function being called.{quote}If you want to call another Puppet function (like include) from inside a function, use the special call_function(name, args, &block) method.# Flatten an array of arrays of strings, then pass it to include:def include_nested(array_of_arrays)  call_function('include', array_of_arrays.flatten)endThe first argument must be the name of the function to call, as a string.The second argument must be an array containing any arguments to the function.The third argument can be a Ruby Proc, or a Puppet lambda previously captured as a Proc (see above). You can also provide a block of Ruby code using the normal block syntax.def my_function1(a, b, &block)  # passing given Proc  call_function('my_other_function', [a, b], &block)enddef my_function2(a, b)  # using a Ruby block  call_function('my_other_function', [a, b]) { |x| ... }end{quote}??https://puppet.com/docs/puppet/5.3/functions_ruby_implementation.html#calling-other-functions ??In my experience, this is not accurate. Attempts to pass an array of arguments in the second position consistently failed. Details: https://gist.github.com/nrwahl2/2d580fd564794da8a685f1a965d832f9To summarize, what I tried to do is:{code:ruby}kernel_modules = scope['facts']['kernel_modules']builtin_kmods = call_function('get_builtin_kmods', [kernel_modules]){code}The error I received is:{code}Evaluation Error: Error while evaluating a Function Call, 'get_builtin_kmods' parameter 'kernel_modules' expects a Hash value, got Tuple{code}{{$facts['kernel_modules']}} is a custom fact containing a {{Hash[String, String]}} value. Based on the documentation, my call to {{call_function()}} should have sent a one-element array of arguments to the {{get_builtin_kmods}} function. Instead, it sent one argument, which was a one-element array.It worked as expected when I removed the square brackets and used{code:ruby}builtin_kmods = call_function('get_builtin_kmods', kernel_modules){code}Based on this and on examples from stdlib, it seems that this implementation of {{call_function()}} takes a sequence of arguments corresponding one-to-one to what gets passed to the called function, rather than taking an array each element of which gets passed to the called function.{code}stdlib/lib/puppet/functions/validate_legacy.rb:call_function('deprecation', 'validate_legacy', error_msg)stdlib/lib/puppet/functions/validate_legacy.rb:call_function('fail', error_msg)stdlib/lib/puppet/functions/validate_ip_address.rb:call_function('deprecation', 'validate_ip_address', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Ip_Address. There is further documentation for validate_legacy function in the README.")stdlib/lib/puppet/functions/is_string.rb:call_function('deprecation', 'is_string', "This method is deprecated, please use match expressions with Stdlib::Compat::String instead. They are described at https://docs.puppet.com/puppet/late

Jira (PUP-8192) call_function() documentation incorrect on 'Writing functions in Ruby'

2017-11-22 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8192 
 
 
 
  call_function() documentation incorrect on 'Writing functions in Ruby'  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 The documentation for writing custom functions in Ruby states that the second argument to {{call_function}} is an array containing all arguments that will be passed to the function being called.{quote}If you want to call another Puppet function (like include) from inside a function, use the special call_function(name, args, &block) method.# Flatten an array of arrays of strings, then pass it to include:def include_nested(array_of_arrays)  call_function('include', array_of_arrays.flatten)endThe first argument must be the name of the function to call, as a string.The second argument must be an array containing any arguments to the function.The third argument can be a Ruby Proc, or a Puppet lambda previously captured as a Proc (see above). You can also provide a block of Ruby code using the normal block syntax.def my_function1(a, b, &block)  # passing given Proc  call_function('my_other_function', [a, b], &block)enddef my_function2(a, b)  # using a Ruby block  call_function('my_other_function', [a, b]) { |x| ... }end{quote}??https://puppet.com/docs/puppet/5.3/functions_ruby_implementation.html#calling-other-functions??In my experience, this is not accurate. Attempts to pass an array of arguments in the second position consistently failed. Details: https://gist.github.com/nrwahl2/2d580fd564794da8a685f1a965d832f9To summarize, what I tried to do is:{code:ruby}kernel_modules = scope['facts']['kernel_modules']builtin_kmods = call_function('get_builtin_kmods', [kernel_modules]){code}The error I received is:{code}Evaluation Error: Error while evaluating a Function Call, 'get_builtin_kmods' parameter 'kernel_modules' expects a Hash value, got Tuple{code}{{$facts['kernel_modules']}} is a custom fact containing a {{Hash[String, String]}} value. Based on the documentation, my call to {{call_function()}} should have sent a one-element array of arguments to the {{get_builtin_kmods}} function. Instead, it sent one argument, which was a one-element array.It worked as expected when I removed the square brackets and used{code:ruby}builtin_kmods = call_function('get_builtin_kmods', kernel_modules){code}Based on this and on examples from stdlib, it seems that this implementation of {{call_function()}} takes a sequence of arguments corresponding one-to-one to what gets passed to the called function, rather than taking an array each element of which gets passed to the called function.{code}stdlib/lib/puppet/functions/validate_legacy.rb:call_function('deprecation', 'validate_legacy', error_msg)stdlib/lib/puppet/functions/validate_legacy.rb:call_function('fail', error_msg)stdlib/lib/puppet/functions/validate_ip_address.rb:call_function('deprecation', 'validate_ip_address', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Ip_Address. There is further documentation for validate_legacy function in the README.")stdlib/lib/puppet/functions/is_string.rb:call_function('deprecation', 'is_string', "This method is deprecated, please use match expressions with Stdlib::Compat::String instead. They are described at https://docs.puppet.com/puppet/lates

Jira (PUP-8192) call_function() documentation incorrect on 'Writing functions in Ruby'

2017-11-22 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8192 
 
 
 
  call_function() documentation incorrect on 'Writing functions in Ruby'  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 The documentation for writing custom functions in Ruby states that the second argument to {{call_function}} is an array containing all arguments that will be passed to the function being called.{quote}If you want to call another Puppet function (like include) from inside a function, use the special call_function(name, args, &block) method.# Flatten an array of arrays of strings, then pass it to include:def include_nested(array_of_arrays)  call_function('include', array_of_arrays.flatten)endThe first argument must be the name of the function to call, as a string.The second argument must be an array containing any arguments to the function.The third argument can be a Ruby Proc, or a Puppet lambda previously captured as a Proc (see above). You can also provide a block of Ruby code using the normal block syntax.def my_function1(a, b, &block)  # passing given Proc  call_function('my_other_function', [a, b], &block)enddef my_function2(a, b)  # using a Ruby block  call_function('my_other_function', [a, b]) { |x| ... }end{quote}Source: https://puppet.com/docs/puppet/5.3/functions_ruby_implementation.html#calling-other-functions ??citation??   In my experience, this is not accurate. Attempts to pass an array of arguments in the second position consistently failed. Details: https://gist.github.com/nrwahl2/2d580fd564794da8a685f1a965d832f9To summarize, what I tried to do is:{code:ruby}kernel_modules = scope['facts']['kernel_modules']builtin_kmods = call_function('get_builtin_kmods', [kernel_modules]){code}The error I received is:{code}Evaluation Error: Error while evaluating a Function Call, 'get_builtin_kmods' parameter 'kernel_modules' expects a Hash value, got Tuple{code}{{$facts['kernel_modules']}} is a custom fact containing a {{Hash[String, String]}} value. Based on the documentation, my call to {{call_function()}} should have sent a one-element array of arguments to the {{get_builtin_kmods}} function. Instead, it sent one argument, which was a one-element array.It worked as expected when I removed the square brackets and used{code:ruby}builtin_kmods = call_function('get_builtin_kmods', kernel_modules){code}Based on this and on examples from stdlib, it seems that this implementation of {{call_function()}} takes a sequence of arguments corresponding one-to-one to what gets passed to the called function, rather than taking an array each element of which gets passed to the called function.{code}stdlib/lib/puppet/functions/validate_legacy.rb:call_function('deprecation', 'validate_legacy', error_msg)stdlib/lib/puppet/functions/validate_legacy.rb:call_function('fail', error_msg)stdlib/lib/puppet/functions/validate_ip_address.rb:call_function('deprecation', 'validate_ip_address', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Ip_Address. There is further documentation for validate_legacy function in the README.")stdlib/lib/puppet/functions/is_string.rb:call_function('deprecation', 'is_string', "This method is deprecated, please use match expressions with Stdlib::Compat::String instead. They are described at https://docs.pup

Jira (PUP-8192) call_function() documentation incorrect on 'Writing functions in Ruby'

2017-11-22 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8192 
 
 
 
  call_function() documentation incorrect on 'Writing functions in Ruby'  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 The documentation for writing custom functions in Ruby states that the second argument to {{call_function}} is an array containing all arguments that will be passed to the function being called.{quote}If you want to call another Puppet function (like include) from inside a function, use the special call_function(name, args, &block) method.# Flatten an array of arrays of strings, then pass it to include:def include_nested(array_of_arrays)  call_function('include', array_of_arrays.flatten)endThe first argument must be the name of the function to call, as a string.The second argument must be an array containing any arguments to the function.The third argument can be a Ruby Proc, or a Puppet lambda previously captured as a Proc (see above). You can also provide a block of Ruby code using the normal block syntax.def my_function1(a, b, &block)  # passing given Proc  call_function('my_other_function', [a, b], &block)enddef my_function2(a, b)  # using a Ruby block  call_function('my_other_function', [a, b]) { |x| ... }end{quote}Source: https://puppet.com/docs/puppet/5.3/functions_ruby_implementation.html#calling-other-functions ??https://puppet.com/docs/puppet/5.3/functions_ruby_implementation.html#calling-other-functions??   In my experience, this is not accurate. Attempts to pass an array of arguments in the second position consistently failed. Details: https://gist.github.com/nrwahl2/2d580fd564794da8a685f1a965d832f9To summarize, what I tried to do is:{code:ruby}kernel_modules = scope['facts']['kernel_modules']builtin_kmods = call_function('get_builtin_kmods', [kernel_modules]){code}The error I received is:{code}Evaluation Error: Error while evaluating a Function Call, 'get_builtin_kmods' parameter 'kernel_modules' expects a Hash value, got Tuple{code}{{$facts['kernel_modules']}} is a custom fact containing a {{Hash[String, String]}} value. Based on the documentation, my call to {{call_function()}} should have sent a one-element array of arguments to the {{get_builtin_kmods}} function. Instead, it sent one argument, which was a one-element array.It worked as expected when I removed the square brackets and used{code:ruby}builtin_kmods = call_function('get_builtin_kmods', kernel_modules){code}Based on this and on examples from stdlib, it seems that this implementation of {{call_function()}} takes a sequence of arguments corresponding one-to-one to what gets passed to the called function, rather than taking an array each element of which gets passed to the called function.{code}stdlib/lib/puppet/functions/validate_legacy.rb:call_function('deprecation', 'validate_legacy', error_msg)stdlib/lib/puppet/functions/validate_legacy.rb:call_function('fail', error_msg)stdlib/lib/puppet/functions/validate_ip_address.rb:call_function('deprecation', 'validate_ip_address', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Ip_Address. There is further documentation for validate_legacy function in the README.")stdlib/lib/puppet/functions/is_string.rb:call_function('deprecation', 'is_string', "This method is deprecated, please use match ex

Jira (PUP-8192) call_function() documentation incorrect on 'Writing functions in Ruby'

2017-11-22 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8192 
 
 
 
  call_function() documentation incorrect on 'Writing functions in Ruby'  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 The documentation for writing custom functions in Ruby states that the second argument to {{call_function}} is an array containing all arguments that will be passed to the function being called.{quote}If you want to call another Puppet function (like include) from inside a function, use the special call_function(name, args, &block) method.# Flatten an array of arrays of strings, then pass it to include:def include_nested(array_of_arrays)  call_function('include', array_of_arrays.flatten)endThe first argument must be the name of the function to call, as a string.The second argument must be an array containing any arguments to the function.The third argument can be a Ruby Proc, or a Puppet lambda previously captured as a Proc (see above). You can also provide a block of Ruby code using the normal block syntax.def my_function1(a, b, &block)  # passing given Proc  call_function('my_other_function', [a, b], &block)enddef my_function2(a, b)  # using a Ruby block  call_function('my_other_function', [a, b]) { |x| ... }end{quote} ??  Source: https://puppet.com/docs/puppet/5.3/functions_ruby_implementation.html#calling-other-functions   ?? citation??   In my experience, this is not accurate. Attempts to pass an array of arguments in the second position consistently failed. Details: https://gist.github.com/nrwahl2/2d580fd564794da8a685f1a965d832f9To summarize, what I tried to do is:{code:ruby}kernel_modules = scope['facts']['kernel_modules']builtin_kmods = call_function('get_builtin_kmods', [kernel_modules]){code}The error I received is:{code}Evaluation Error: Error while evaluating a Function Call, 'get_builtin_kmods' parameter 'kernel_modules' expects a Hash value, got Tuple{code}{{$facts['kernel_modules']}} is a custom fact containing a {{Hash[String, String]}} value. Based on the documentation, my call to {{call_function()}} should have sent a one-element array of arguments to the {{get_builtin_kmods}} function. Instead, it sent one argument, which was a one-element array.It worked as expected when I removed the square brackets and used{code:ruby}builtin_kmods = call_function('get_builtin_kmods', kernel_modules){code}Based on this and on examples from stdlib, it seems that this implementation of {{call_function()}} takes a sequence of arguments corresponding one-to-one to what gets passed to the called function, rather than taking an array each element of which gets passed to the called function.{code}stdlib/lib/puppet/functions/validate_legacy.rb:call_function('deprecation', 'validate_legacy', error_msg)stdlib/lib/puppet/functions/validate_legacy.rb:call_function('fail', error_msg)stdlib/lib/puppet/functions/validate_ip_address.rb:call_function('deprecation', 'validate_ip_address', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Ip_Address. There is further documentation for validate_legacy function in the README.")stdlib/lib/puppet/functions/is_string.rb:call_function('deprecation', 'is_string', "This method is deprecated, please use match expressions with Stdlib::Compat::String instead. They are described at https://

Jira (PUP-8192) call_function() documentation incorrect on 'Writing functions in Ruby'

2017-11-22 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-8192 
 
 
 
  call_function() documentation incorrect on 'Writing functions in Ruby'  
 
 
 
 
 
 
 
 
 

Change By:
 
 Reid Wahl 
 
 
 
 
 
 
 
 
 
 The documentation for writing custom functions in Ruby states that the second argument to {{call_function}} is an array containing all arguments that will be passed to the function being called.{quote}If you want to call another Puppet function (like include) from inside a function, use the special call_function(name, args, &block) method.# Flatten an array of arrays of strings, then pass it to include:def include_nested(array_of_arrays)  call_function('include', array_of_arrays.flatten)endThe first argument must be the name of the function to call, as a string.The second argument must be an array containing any arguments to the function.The third argument can be a Ruby Proc, or a Puppet lambda previously captured as a Proc (see above). You can also provide a block of Ruby code using the normal block syntax.def my_function1(a, b, &block)  # passing given Proc  call_function('my_other_function', [a, b], &block)enddef my_function2(a, b)  # using a Ruby block  call_function('my_other_function', [a, b]) { |x| ... }end{quote}Source: https://puppet.com/docs/puppet/5.3/functions_ruby_implementation.html#calling-other-functions ??https://puppet.com/docs/puppet/5.3/functions_ruby_implementation.html#calling-other-functions??   In my experience, this is not accurate. Attempts to pass an array of arguments in the second position consistently failed. Details: https://gist.github.com/nrwahl2/2d580fd564794da8a685f1a965d832f9To summarize, what I tried to do is:{code:ruby}kernel_modules = scope['facts']['kernel_modules']builtin_kmods = call_function('get_builtin_kmods', [kernel_modules]){code}The error I received is:{code}Evaluation Error: Error while evaluating a Function Call, 'get_builtin_kmods' parameter 'kernel_modules' expects a Hash value, got Tuple{code}{{$facts['kernel_modules']}} is a custom fact containing a {{Hash[String, String]}} value. Based on the documentation, my call to {{call_function()}} should have sent a one-element array of arguments to the {{get_builtin_kmods}} function. Instead, it sent one argument, which was a one-element array.It worked as expected when I removed the square brackets and used{code:ruby}builtin_kmods = call_function('get_builtin_kmods', kernel_modules){code}Based on this and on examples from stdlib, it seems that this implementation of {{call_function()}} takes a sequence of arguments corresponding one-to-one to what gets passed to the called function, rather than taking an array each element of which gets passed to the called function.{code}stdlib/lib/puppet/functions/validate_legacy.rb:call_function('deprecation', 'validate_legacy', error_msg)stdlib/lib/puppet/functions/validate_legacy.rb:call_function('fail', error_msg)stdlib/lib/puppet/functions/validate_ip_address.rb:call_function('deprecation', 'validate_ip_address', "This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Ip_Address. There is further documentation for validate_legacy function in the README.")stdlib/lib/puppet/functions/is_string.rb:call_function('deprecation', 'is_string', "This method is deprecated, please use match ex

Jira (PUP-8192) call_function() documentation incorrect on 'Writing functions in Ruby'

2017-11-22 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-8192 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: call_function() documentation incorrect on 'Writing functions in Ruby'  
 
 
 
 
 
 
 
 
 
 
I'm holding off on a revision and PR until engineering chimes in on what the behavior SHOULD be... either way at this point if we were to change the behavior to match the documentation, we'd break a bunch of existing code. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-8192) call_function() documentation incorrect on 'Writing functions in Ruby'

2017-11-22 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-8192 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: call_function() documentation incorrect on 'Writing functions in Ruby'  
 
 
 
 
 
 
 
 
 
 
I should note that I haven't tested the functionality on 5.x, only checked that the documentation has not changed. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-8187) `puppet master compile` fails to save the catalog with arbitrary binary data in file resources

2017-11-25 Thread Reid Wahl (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Reid Wahl commented on  PUP-8187 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: `puppet master compile` fails to save the catalog with arbitrary binary data in file resources  
 
 
 
 
 
 
 
 
 
 
master compile is using the Ruby JSON module: 
 
 
 
 
 
 
  puts JSON::pretty_generate(catalog.to_resource, :allow_nan => true, :max_nesting => false)
 
 
 
 
 
 
 
By contrast, the serialization error that Johnson mentioned is coming from the Puppet::Resource::Catalog::JSON.to_json method: 
 
 
 
 
 
 
class Puppet::Resource::Catalog::Json < Puppet::Indirector::JSON 
 
 
 
 
  desc "Store catalogs as flat files, serialized using JSON." 
 
 
 
 
... 
 
 
 
 
  def to_json(object) 
 
 
 
 
object.render('json') 
 
 
 
 
  rescue Puppet::Network::FormatHandler::FormatError 
 
 
 
 
Puppet.info(_("Unable to serialize catalog to json, retrying with pson"))