Bug 212420 - [PATCH] net/foreman-proxy: update to 1.12.2
Summary: [PATCH] net/foreman-proxy: update to 1.12.2
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ruby (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2016-09-06 16:29 UTC by Frank Wall
Modified: 2017-05-16 11:29 UTC (History)
5 users (show)

See Also:
bugzilla: maintainer-feedback? (ruby)


Attachments
net/foreman-proxy: update to 1.12.2 (23.35 KB, text/plain)
2016-09-06 16:29 UTC, Frank Wall
no flags Details
net_foreman_proxy.patch (1.03 KB, patch)
2017-01-27 14:47 UTC, Karli Sjöberg
no flags Details | Diff
rubygem-sinatra.patch (673 bytes, patch)
2017-01-30 09:17 UTC, Karli Sjöberg
no flags Details | Diff
foreman-proxy.tar.gz (2.85 KB, application/gzip)
2017-02-22 08:31 UTC, Karli Sjöberg
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Wall 2016-09-06 16:29:17 UTC
Created attachment 174421 [details]
net/foreman-proxy: update to 1.12.2

This patch updates foreman-proxy to version 1.12.2.
This release supports Puppet 4 and provides many more enhancements.
Build tested with poudriere on FreeBSD 10.3 amd64.

Since this is a major step from the previous version 1.10.0
an entry should be added to UPDATING:

In version 1.11+ Foreman Smart Proxy splits its configuration in even
smaller chunks located in PREFIX/etc/foreman-proxy/settings.d.
You can use a bundled script to convert your old settings to new settings:
PREFIX/share/foreman/extra/migrate_settings.rb
Comment 1 commit-hook freebsd_committer freebsd_triage 2016-12-08 00:15:47 UTC
A commit references this bug:

Author: swills
Date: Thu Dec  8 00:14:51 UTC 2016
New revision: 428092
URL: https://svnweb.freebsd.org/changeset/ports/428092

Log:
  net/foreman-proxy: update to 1.12.2

  PR:		212420
  Submitted by:	Frank Wall <fw@moov.de>

Changes:
  head/net/foreman-proxy/Makefile
  head/net/foreman-proxy/distinfo
  head/net/foreman-proxy/files/patch-config-settings.d-dhcp.yml.example
  head/net/foreman-proxy/files/patch-config-settings.d-puppet.yml.example
  head/net/foreman-proxy/files/patch-config-settings.d-puppetca.yml.example
  head/net/foreman-proxy/files/patch-config-settings.d-realm.yml.example
  head/net/foreman-proxy/files/patch-config-settings.d-tftp.yml.example
  head/net/foreman-proxy/files/patch-config-settings.yml.example
  head/net/foreman-proxy/files/patch-config_settings.d_dns__nsupdate.yml.example
  head/net/foreman-proxy/files/patch-config_settings.d_dns__nsupdate__gss.yml.example
  head/net/foreman-proxy/pkg-message
  head/net/foreman-proxy/pkg-plist
Comment 2 Steve Wills freebsd_committer freebsd_triage 2016-12-08 00:19:32 UTC
Used pkg-message instead of UPDATING since it's more relevant to users of the port than all ports users. Also skipped installing the gemspec since it's not needed. Let me know if there are any issues. Thanks for the patch and sorry it took so long.
Comment 3 Karli Sjöberg 2017-01-11 07:17:07 UTC
Thanks Frank! Was thinking about this a while ago but never got around to it. Kudos!
Comment 4 Karli Sjöberg 2017-01-27 12:01:58 UTC
Hey Frank!

I´ve built the new version on two different machines, at home and at work, installed it on two different clients, also at home & work. When I try to 'service foreman-proxy start', this happens:
# service foreman-proxy onestart
Starting foreman_proxy.
/usr/local/lib/ruby/gems/2.2/gems/bundler-1.14.3/lib/bundler/dsl.rb:81:in `gemspec':  (Bundler::Dsl::DSLError)
[!] There was an error parsing `Gemfile.in`: There are no gemspecs at /usr/local/share/foreman-proxy. Bundler cannot continue.

 #  from /usr/local/share/foreman-proxy/Gemfile.in:3
 #  -------------------------------------------
 #  
 >  gemspec
 #  
 #  -------------------------------------------
        from /usr/local/share/foreman-proxy/Gemfile.in:3:in `eval_gemfile'
        from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.14.3/lib/bundler/dsl.rb:41:in `instance_eval'
        from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.14.3/lib/bundler/dsl.rb:41:in `eval_gemfile'
        from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.14.3/lib/bundler/dsl.rb:11:in `evaluate'
        from /usr/local/lib/ruby/gems/2.2/gems/bundler_ext-0.4.1/lib/bundler_ext/gemfile.rb:46:in `parse'
        from /usr/local/lib/ruby/gems/2.2/gems/bundler_ext-0.4.1/lib/bundler_ext.rb:14:in `system_require'
        from /usr/local/share/foreman-proxy/lib/bundler_helper.rb:22:in `require_groups'
        from /usr/local/share/foreman-proxy/lib/smart_proxy_main.rb:32:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/sbin/smart-proxy:6:in `<main>'
/usr/local/etc/rc.d/foreman-proxy: WARNING: failed to start foreman_proxy

What am I missing?

Best Regards
Karli Sjöberg
Comment 5 Frank Wall 2017-01-27 12:14:07 UTC
Hi Karli,

unfortunately my initial patch was adjusted and the Gemfile was removed. That's why the FreeBSD port is currently broken. We need to re-add the Gemfile. I hope @swills can do a quick fix.

I'll prepare a new PATCH for SmartProxy 1.14... but this will take more time.


Regards
- Frank
Comment 6 Karli Sjöberg 2017-01-27 14:46:35 UTC
I did this net_foreman_proxy.patch which built OK, but didn´t improve my situation unfortunately:
Starting foreman_proxy.
/usr/local/lib/ruby/site_ruby/2.2/rubygems/specification.rb:2288:in `raise_if_conflicts': Unable to activate sinatra-1.4.7, because rack-2.0.1 conflicts with rack (~> 1.5) (Gem::ConflictError)
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/specification.rb:1408:in `activate'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems.rb:220:in `rescue in try_activate'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems.rb:213:in `try_activate'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:126:in `rescue in require'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:40:in `require'
        from /usr/local/share/foreman-proxy/lib/smart_proxy_main.rb:37:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/sbin/smart-proxy:6:in `<main>'
/usr/local/etc/rc.d/foreman-proxy: WARNING: failed to start foreman_proxy

Any tips?

Best Regards
Karli Sjöberg
Comment 7 Karli Sjöberg 2017-01-27 14:47:13 UTC
Created attachment 179354 [details]
net_foreman_proxy.patch
Comment 8 Steve Wills freebsd_committer freebsd_triage 2017-01-27 15:59:31 UTC
(In reply to Karli Sjöberg from comment #7)
Thanks, this patch seems to be necessary but no quite sufficient to fix the issue. You've also got to avoid rack 2.0 being installed. That means creating a www/rubygem-rack-protection-rack16 port which depends on rack 1.6.x and modifying www/sinatra to use it. I've done that locally and tested it, but since some other things use sinatra, I am going to need to test those first before committing both sets of changes. I'm working on that now.
Comment 9 Karli Sjöberg 2017-01-28 10:57:02 UTC
(In reply to Steve Wills from comment #8)
Why do we have to depend on rack-1.6? I had a look at sinatra's dependencies:
https://rubygems.org/gems/sinatra/versions/1.4.6
"rack ~> 1.4"

Doesn't say anything about _not_ using 2.0 or greater.

The Gemfile specification just says:
"s.add_dependency 'rack', '>= 1.1', '< 1.6' # ruby 1.8.7 support is broken in rack 1.6 versions < 1.6.4"

I don't interpret this as incompatible with rack-2.0 either, just that you can't use ruby-1.8 any more, which is removed from ports anyway.

Is this a correct conclusion?

Best Regards
Karli Sjöberg
Comment 10 Karli Sjöberg 2017-01-30 09:17:10 UTC
OK, so I answered my own question; I modified rubygem-sinatra as in this "rubygem-sinatra.patch", which built and installed just fine. It was also possible to start the foreman-proxy service. Sadly, sinatra really is incompatible with rack-2.0 as it errors out trying to add the proxy in foreman:
E, [2017-01-30T10:07:06.933036 #1301] ERROR -- : undefined method `bytesize' for Rack::Utils:Module (NoMethodError)
/usr/local/lib/ruby/gems/2.2/gems/sinatra-1.4.7/lib/sinatra/show_exceptions.rb:47:in `rescue in call'
/usr/local/lib/ruby/gems/2.2/gems/sinatra-1.4.7/lib/sinatra/show_exceptions.rb:25:in `call'
/usr/local/lib/ruby/gems/2.2/gems/sinatra-1.4.7/lib/sinatra/base.rb:182:in `call'
/usr/local/lib/ruby/gems/2.2/gems/sinatra-1.4.7/lib/sinatra/base.rb:2013:in `call'
/usr/local/lib/ruby/gems/2.2/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:in `block in call'
/usr/local/lib/ruby/gems/2.2/gems/sinatra-1.4.7/lib/sinatra/base.rb:1787:in `synchronize'
/usr/local/lib/ruby/gems/2.2/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:in `call'
/usr/local/lib/ruby/gems/2.2/gems/rack-2.0.1/lib/rack/urlmap.rb:68:in `block in call'
/usr/local/lib/ruby/gems/2.2/gems/rack-2.0.1/lib/rack/urlmap.rb:53:in `each'
/usr/local/lib/ruby/gems/2.2/gems/rack-2.0.1/lib/rack/urlmap.rb:53:in `call'
/usr/local/lib/ruby/gems/2.2/gems/rack-2.0.1/lib/rack/builder.rb:153:in `call'
/usr/local/lib/ruby/gems/2.2/gems/rack-2.0.1/lib/rack/handler/webrick.rb:86:in `service'
/usr/local/lib/ruby/2.2/webrick/httpserver.rb:138:in `service'
/usr/local/lib/ruby/2.2/webrick/httpserver.rb:94:in `run'
/usr/local/lib/ruby/2.2/webrick/server.rb:294:in `block in start_thread'

Best Regards
Karli Sjöberg
Comment 11 Karli Sjöberg 2017-01-30 09:17:49 UTC
Created attachment 179418 [details]
rubygem-sinatra.patch
Comment 12 Karli Sjöberg 2017-02-22 08:31:03 UTC
Created attachment 180212 [details]
foreman-proxy.tar.gz
Comment 13 Karli Sjöberg 2017-02-22 08:42:20 UTC
(In reply to Steve Wills from comment #8)
I assume because of the passivity in this report that the change proposed is "scary" and may break other things, so I come here with a different approach. Instead of holding rack back, potentially causing issues for other ports, I´ve created new ports for the dependencies needed by foreman-proxy. This way, we change foreman-proxy to suite it´s needs and nothing else. I´ve called them:
www/rubygem-sinatra2
www/rubygem-rack-protection2
devel/rubygem-mustermann1

I changed 'net/foreman-proxy' to use 'www/rubygem-sinatra2', plus change the dependency to rack 2.0 in foreman-proxy´s gemspec.

The port build, installs and runs without issue on three different proxies, puppet- and ca, tftp and dhcp so far.

I tar'ed my changes into the 'foreman-proxy.tar.gz' file attached to the PR. Is this an acceptable solution to this problem?

Best Regards
Karli Sjöberg
Comment 14 Karli Sjöberg 2017-03-29 05:31:38 UTC
Hello!

It´s really starting to feel like I´m talking to myself here, last response from anyone else was two months ago and foreman-proxy was broken long before that. Our organization heavily depends on foreman-proxy working in FreeBSD so we would much appreciate this issue getting solved one way or another.

Has my proposal been reviewed? Was there anything "wrong" with it, or would you say that this is the way forward out of this?

Best Regards
Karli Sjöberg
Comment 15 Frank Wall 2017-05-16 11:29:18 UTC
I've submitted bug report 219329 to update net/foreman-proxy to version 1.15.0. This old bug report is obsolete now. Please proceed with bug report 219329 instead.