Jira (FACT-1892) pe-task's facter_task is failing with the promotion of puppet-agent 5.5.6.180.g8b5d99d

2018-10-19 Thread Enis Inan (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Enis Inan updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Facter /  FACT-1892  
 
 
  pe-task's facter_task is failing with the promotion of puppet-agent 5.5.6.180.g8b5d99d   
 

  
 
 
 
 

 
Change By: 
 Enis Inan  
 
 
Comment: 
 Nevermind on the STDOUT => STDERR redirection. I realized my custom fact was using STDOUT instead of $stdout (apologies for being an idiot there). Changing it to $stdout.puts shows that FACT-1870 is doing the right thing.Looks like the issue is just the safe_posix_fork stuff I mentioned earlier.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)  
 
 

 
   
 

  
 

  
 

   





-- 
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 (FACT-1892) pe-task's facter_task is failing with the promotion of puppet-agent 5.5.6.180.g8b5d99d

2018-10-19 Thread Enis Inan (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Enis Inan updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Facter /  FACT-1892  
 
 
  pe-task's facter_task is failing with the promotion of puppet-agent 5.5.6.180.g8b5d99d   
 

  
 
 
 
 

 
Change By: 
 Enis Inan  
 
 
Comment: 
 There's several things going on here. Here's my custom fact:{code}Facter.add('custom_fact') do  setcode dorequire 'puppet'Puppet::Util::Execution.execute('echo THIS_SHOULD_NOT_PRINT')STDOUT.puts("STDOUT")'custom_fact'  endend{code}Invoking facter:{code}[root@v4wf528eg09c0we ~]# facter --custom-dir CUSTOM_FACTS/ --json --debug --query custom_fact 2>/dev/nullCALLING EXECUTE, SHOULD NOT PRINTSTDOUT{  "custom_fact": "custom_fact"}{code}When reverting the changes for FACT-1870, here's what's displayed{code}[root@v4wf528eg09c0we ~]# facter --custom-dir CUSTOM_FACTS/ --json --debug --query custom_fact 2>/dev/nullSTDOUT{  "custom_fact": "custom_fact"}{code}It looks like STDOUT isn't being redirected to STDERR, and whatever's happening is also messing up Puppet::Util::Execution.execute (the latter is why all of that rpm output was there when running the task).  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To 

Jira (FACT-1892) pe-task's facter_task is failing with the promotion of puppet-agent 5.5.6.180.g8b5d99d

2018-10-19 Thread Enis Inan (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Enis Inan updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Facter /  FACT-1892  
 
 
  pe-task's facter_task is failing with the promotion of puppet-agent 5.5.6.180.g8b5d99d   
 

  
 
 
 
 

 
Change By: 
 Enis Inan  
 
 
Comment: 
 Redirecting STDOUT to STDERR messes up Puppet::Util::Execution{code}enis:facter enis.inan$ irb2.4.2 :001 > require 'puppet' => true2.4.2 :002 > x = Puppet::Util::Execution.execute("echo CALLED_EXECUTE") => "CALLED_EXECUTE\n"2.4.2 :003 > x => "CALLED_EXECUTE\n"2.4.2 :004 > $stdout = $stderr => #>2.4.2 :005 > x = Puppet::Util::Execution.execute("echo CALLED_EXECUTE")CALLED_EXECUTE => ""2.4.2 :006 > x => ""{code}And{code}enis:facter enis.inan$ irb 2>/dev/null2.4.2 :001 > require 'puppet' => true2.4.2 :002 > x = Puppet::Util::Execution.execute("echo CALLED_EXECUTE") => "CALLED_EXECUTE\n"2.4.2 :003 > x => "CALLED_EXECUTE\n"2.4.2 :004 > $stderr.puts("SHOULD NOT PRINT") => nil2.4.2 :005 > $stdout = $stderr2.4.2 :006 > x = Puppet::Util::Execution.execute("echo CALLED_EXECUTE")CALLED_EXECUTE2.4.2 :007 > x{code}(even when stderr is redirected to /dev/null, execute still prints something when it is not supposed to).  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google 

Jira (FACT-1892) pe-task's facter_task is failing with the promotion of puppet-agent 5.5.6.180.g8b5d99d

2018-10-19 Thread Enis Inan (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Enis Inan commented on  FACT-1892  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: pe-task's facter_task is failing with the promotion of puppet-agent 5.5.6.180.g8b5d99d   
 

  
 
 
 
 

 
 Nevermind on the STDOUT => STDERR redirection. I realized my custom fact was using STDOUT instead of $stdout. Changing it to $stdout.puts shows that FACT-1870 is doing the right thing. Looks like the issue is just the safe_posix_fork stuff I mentioned earlier.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)  
 
 

 
   
 

  
 

  
 

   





-- 
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 (FACT-1892) pe-task's facter_task is failing with the promotion of puppet-agent 5.5.6.180.g8b5d99d

2018-10-19 Thread Enis Inan (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Enis Inan commented on  FACT-1892  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: pe-task's facter_task is failing with the promotion of puppet-agent 5.5.6.180.g8b5d99d   
 

  
 
 
 
 

 
 Figured out what's going on for Puppet::Util::Execution.execute. Looking at safe_posix_fork, we reopen $stdin, $stdout, and $stderr. Also note that the child process inherits the parent's STDOUT stream. When $stdout = $stderr, we do not reopen the STDOUT. Thus, the child process will not be writing to our passed-in stdout but to the parent's stdout instead. Fixing that part to open the STDOUT and STDERR constants instead produces the right behavior.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)  
 
 

 
   
 

  
 

  
 

   





-- 
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 (FACT-1892) pe-task's facter_task is failing with the promotion of puppet-agent 5.5.6.180.g8b5d99d

2018-10-18 Thread Enis Inan (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Enis Inan commented on  FACT-1892  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: pe-task's facter_task is failing with the promotion of puppet-agent 5.5.6.180.g8b5d99d   
 

  
 
 
 
 

 
 Redirecting STDOUT to STDERR messes up Puppet::Util::Execution  
 
 
 
 
 enis:facter enis.inan$ irb  
 
 
 2.4.2 :001 > require 'puppet'  
 
 
  => true  
 
 
 2.4.2 :002 > x = Puppet::Util::Execution.execute("echo CALLED_EXECUTE")  
 
 
  => "CALLED_EXECUTE\n"  
 
 
 2.4.2 :003 > $stdout = $stderr  
 
 
  => #>  
 
 
 2.4.2 :004 > x = Puppet::Util::Execution.execute("echo CALLED_EXECUTE")  
 
 
 CALLED_EXECUTE  
 
 
  => ""  
 
 
 2.4.2 :005 > x  
 
 
  => ""
  
 
 
 
  And  
 
 
 
 

Jira (FACT-1892) pe-task's facter_task is failing with the promotion of puppet-agent 5.5.6.180.g8b5d99d

2018-10-18 Thread Enis Inan (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Enis Inan commented on  FACT-1892  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: pe-task's facter_task is failing with the promotion of puppet-agent 5.5.6.180.g8b5d99d   
 

  
 
 
 
 

 
 There's several things going on here. Here's my custom fact:  
 
 
 
 
 Facter.add('custom_fact') do  
 
 
   setcode do  
 
 
 require 'puppet'  
 
 
 Puppet::Util::Execution.execute('echo THIS_SHOULD_NOT_PRINT')  
 
 
 STDOUT.puts("STDOUT")  
 
 
    
 
 
 'custom_fact'  
 
 
   end  
 
 
 end
  
 
 
 
  Invoking facter:  
 
 
 
 
 [root@v4wf528eg09c0we ~]# facter --custom-dir CUSTOM_FACTS/ --json --debug --query custom_fact 2>/dev/null  
 
 
 CALLING EXECUTE, SHOULD NOT PRINT  
 
 
 STDOUT  
  

Jira (FACT-1892) pe-task's facter_task is failing with the promotion of puppet-agent 5.5.6.180.g8b5d99d

2018-10-18 Thread Enis Inan (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Enis Inan commented on  FACT-1892  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: pe-task's facter_task is failing with the promotion of puppet-agent 5.5.6.180.g8b5d99d   
 

  
 
 
 
 

 
 Made this a facter ticket because that's what is causing this issue, specifically https://github.com/puppetlabs/facter/pull/1751/commits/4a7ddb9d4ece7af89ecf9546507fe11216d1be5b#diff-cfd7b7fce6a29f4dc809ee437588d58dR335 (I think that commit inadvertently redirected stderr to stdout)  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)  
 
 

 
   
 

  
 

  
 

   





-- 
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 (FACT-1892) pe-task's facter_task is failing with the promotion of puppet-agent 5.5.6.180.g8b5d99d

2018-10-18 Thread Enis Inan (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Enis Inan moved an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Facter /  FACT-1892  
 
 
  pe-task's facter_task is failing with the promotion of puppet-agent 5.5.6.180.g8b5d99d   
 

  
 
 
 
 

 
Change By: 
 Enis Inan  
 
 
Key: 
 PE FACT - 25380 1892  
 
 
Project: 
 Puppet Enterprise [Internal] Facter  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)  
 
 

 
   
 

  
 

  
 

   





-- 
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.