I was having problems with my local ~/.whimsy so I reactivated it and now I 
cannot get past 

require 'whimsy/asf'

If I remove .whimsy it works until the mail.deliver! line.

ls -l ~/.whimsy
-rw-------  1 clr  staff  518 Jun 22 19:18 /Users/clr/.whimsy

What should the permissions on this file be when running locally?

[Mon Jun 22 19:23:24.993370 2020] [cgi:error] [pid 16958] [client 
127.0.0.1:49390] AH01215: 
/usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/psych.rb:577:in `initialize': 
Permission denied @ rb_sysopen - /Users/clr/.whimsy (Errno::EACCES): 
/srv/whimsy/www/officers/coi.cgi
[Mon Jun 22 19:23:24.993444 2020] [cgi:error] [pid 16958] [client 
127.0.0.1:49390] AH01215: \tfrom 
/usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/psych.rb:577:in `open': 
/srv/whimsy/www/officers/coi.cgi
[Mon Jun 22 19:23:24.993490 2020] [cgi:error] [pid 16958] [client 
127.0.0.1:49390] AH01215: \tfrom 
/usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/psych.rb:577:in `load_file': 
/srv/whimsy/www/officers/coi.cgi
[Mon Jun 22 19:23:24.993537 2020] [cgi:error] [pid 16958] [client 
127.0.0.1:49390] AH01215: \tfrom 
/Users/clr/apache/git/whimsy/lib/whimsy/asf/config.rb:47:in `<class:Config>': 
/srv/whimsy/www/officers/coi.cgi
[Mon Jun 22 19:23:24.993590 2020] [cgi:error] [pid 16958] [client 
127.0.0.1:49390] AH01215: \tfrom 
/Users/clr/apache/git/whimsy/lib/whimsy/asf/config.rb:27:in `<module:ASF>': 
/srv/whimsy/www/officers/coi.cgi
[Mon Jun 22 19:23:24.993637 2020] [cgi:error] [pid 16958] [client 
127.0.0.1:49390] AH01215: \tfrom 
/Users/clr/apache/git/whimsy/lib/whimsy/asf/config.rb:6:in `<top (required)>': 
/srv/whimsy/www/officers/coi.cgi
[Mon Jun 22 19:23:24.993672 2020] [cgi:error] [pid 16958] [client 
127.0.0.1:49390] AH01215: \tfrom /srv/whimsy/lib/whimsy/asf.rb:1:in 
`require_relative': /srv/whimsy/www/officers/coi.cgi
[Mon Jun 22 19:23:24.993707 2020] [cgi:error] [pid 16958] [client 
127.0.0.1:49390] AH01215: \tfrom /srv/whimsy/lib/whimsy/asf.rb:1:in `<top 
(required)>': /srv/whimsy/www/officers/coi.cgi
[Mon Jun 22 19:23:24.993763 2020] [cgi:error] [pid 16958] [client 
127.0.0.1:49390] AH01215: \tfrom 
/usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in
 `require': /srv/whimsy/www/officers/coi.cgi
[Mon Jun 22 19:23:24.993820 2020] [cgi:error] [pid 16958] [client 
127.0.0.1:49390] AH01215: \tfrom 
/usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in
 `require': /srv/whimsy/www/officers/coi.cgi

> On Jun 22, 2020, at 6:43 PM, Sam Ruby <ru...@intertwingly.net> wrote:
> 
> On Mon, Jun 22, 2020 at 7:13 PM Craig Russell <apache....@gmail.com> wrote:
>> 
>> What credentials do I need for the mail application? Testing locally, 
>> running in the infra/whimsy environment?
> 
> See 
> https://github.com/apache/whimsy/blob/master/MACOSX.md#configure-sending-of-mail
> 
> Getting this to work will require you to get ~/.whimsy file to work.
> Previously you deleted/renamed that file so that you can make forward
> progress.  Now that you have a working system, hopefully you can
> recreate that file and identify and address why it wasn't working for
> you.
> 
> Longer answer: mail requires things called a Mail Transfer Agent
> (MTA).  In the early days of the internet, wide open mail transfer
> agents were overrun by spammers.  Now MTAs implement some sort of
> authentication.
> 
> The MTA that services the ASF requires that email come from a
> whitelisted machine.  Generally when we spin up a new VM for whimsy we
> have to ask the infra team to add the new VM to the whitelist.  On
> rare occasions, this has broken and we need to ask the infra team to
> fix it.  Taken together, I wrote a small test tool (mentioned in the
> link above) to verify that sending of mail is possible.
> 
> When testing locally, you will need to conform to what your local mail
> server uses.  In my case, I can use mail.twc.com as long as the email
> is going out through my ISP provided modem.  Or, as mentioned in the
> link above, you can use gmail as the MTA as long as you have a valid
> gmail user and password.  You may have access to other MTAs.
> 
> - Sam Ruby
> 
>>    mail = Mail.new do
>>      to "#{user.public_name}<#{user.mail.first}>"
>> #     cc "secret...@apache.org"
>>      from "#{user.mail.first}"
>>      subject "Conflict of Interest affirmation from #{user.public_name}"
>>      body "This year's Conflict of Interest affirmation is attached."
>>    end
>>    mail.attachments["#{user.id}.txt"] = affirmed
>>    mail.deliver!
>>  end
>> 
>> #<Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 
>> 25>
>>  /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/net/smtp.rb:539:in 
>> `initialize'
>>  /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/net/smtp.rb:539:in `open'
>>  /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/net/smtp.rb:539:in 
>> `tcp_socket'
>>  /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/net/smtp.rb:549:in `block in 
>> do_start'
>>  /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/timeout.rb:95:in `block in 
>> timeout'
>>  /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/timeout.rb:105:in `timeout'
>>  /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/net/smtp.rb:548:in `do_start'
>>  /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/net/smtp.rb:518:in `start'
>>  
>> /usr/local/lib/ruby/gems/2.7.0/gems/mail-2.7.1/lib/mail/network/delivery_methods/smtp.rb:109:in
>>  `start_smtp_session'
>>  
>> /usr/local/lib/ruby/gems/2.7.0/gems/mail-2.7.1/lib/mail/network/delivery_methods/smtp.rb:100:in
>>  `deliver!'
>>  /usr/local/lib/ruby/gems/2.7.0/gems/mail-2.7.1/lib/mail/message.rb:276:in 
>> `deliver!'
>>  /srv/whimsy/www/officers/coi.cgi:177:in `block in emit_post'
>> 
>> 
>>> On Jun 22, 2020, at 3:29 PM, Craig Russell <apache....@gmail.com> wrote:
>>> 
>>> Another couple of questions:
>>> 
>>> 1. What's the best way to --dryrun the commit until I have the rest of the 
>>> application working? I know there are a couple of ways to do it, from 
>>> putting --dryrun into some of the svn commands to using a keyboard entry to 
>>> do it. Is it <ctrl> click on the keyboard?
>>> 
>>> 2. What's the best model for implementing the mailto: user, cc:secretary? 
>>> Is it as easy as require 'mail' and use a whimsy mail API?
>>> 
>>> Thanks,
>>> Craig
>>> 
>>>> On Jun 22, 2020, at 3:23 PM, Sam Ruby <ru...@intertwingly.net> wrote:
>>>> 
>>>> On Mon, Jun 22, 2020 at 5:20 PM Craig Russell <apache....@gmail.com> wrote:
>>>>> 
>>>>> I've pushed a work in progress to branch coi. It currently does what I 
>>>>> want it to do for "get", which is to calculate who is required to affirm 
>>>>> the coi.
>>>>> 
>>>>> But when I submit the "post" it gives an error
>>>>> #<NameError: undefined local variable or method 
>>>>> `coi_current_template_url'>
>>>>> /srv/whimsy/www/officers/coi.cgi:146:in `emit_post'
>>>>> /srv/whimsy/www/officers/coi.cgi:130:in `block (5 levels) in <main>'
>>>>> /srv/whimsy/www/officers/coi.cgi:128:in `block (4 levels) in <main>'
>>>>> /Users/clr/apache/git/whimsy/lib/whimsy/asf/themes.rb:43:in `block (2 
>>>>> levels) in _whimsy_panel'
>>>>> 
>>>>> There is a variable coi_current_template_url but it is out of scope.
>>>>> 
>>>>> Is there documentation/discussion of scoping rules for the whimsy cgi 
>>>>> environment?
>>>>> 
>>>>> I've attached the coi.cgi in case it's easier to see what's gone wrong...
>>>> 
>>>> Scoping rules in Ruby are a bit complicated.  If these values aren't
>>>> expected to be modified, the recommendation is to change the variable
>>>> names to be ALL_CAPS.  If the values are expected to be modified,
>>>> prefix the variable name with a dollar sign ($).
>>>> 
>>>>> Craig L Russell
>>>>> c...@apache.org
>>>> 
>>>> - Sam Ruby
>>> 
>>> Craig L Russell
>>> c...@apache.org
>>> 
>> 
>> Craig L Russell
>> c...@apache.org
>> 

Craig L Russell
c...@apache.org

Reply via email to