Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1438501

Summary: Ruby services that use bundler ext fail to start if /foo exists and is a directory
Product: Red Hat Satellite Reporter: Evgeni Golov <egolov>
Component: PackagingAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Evgeni Golov <egolov>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.8CC: aruzicka, bbuckingham, bkearney, ehelms, fcami, fgarciad, greartes, inecas, itewksbu, jcallaha, mtenheuv
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 17:11:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Evgeni Golov 2017-04-03 14:53:16 UTC
Description of problem:
smart_proxy_dynflow_core fails to start if /foo exists and is a directory


Version-Release number of selected component (if applicable):
Satellite 6.2.8

How reproducible:
100%

Steps to Reproduce:
1. mkdir /foo
2. systemctl restart smart_proxy_dynflow_core

Actual results:
[root@sat62 ~]# systemctl restart smart_proxy_dynflow_core.service
Job for smart_proxy_dynflow_core.service failed because the control process exited with error code. See "systemctl status smart_proxy_dynflow_core.service" and "journalctl -xe" for details.
[root@sat62 ~]# systemctl status smart_proxy_dynflow_core.service
● smart_proxy_dynflow_core.service - Foreman smart proxy dynflow core service
   Loaded: loaded (/usr/lib/systemd/system/smart_proxy_dynflow_core.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2017-04-03 16:23:54 CEST; 3s ago
     Docs: https://github.com/theforeman/smart_proxy_dynflow
  Process: 14576 ExecStart=/usr/bin/smart_proxy_dynflow_core -d -p /var/run/foreman-proxy/smart_proxy_dynflow_core.pid (code=exited, status=1/FAILURE)
 Main PID: 1705


Apr 03 16:23:52 sat62.egolov.example.com systemd[1]: Starting Foreman smart proxy dynflow core service...
Apr 03 16:23:54 sat62.egolov.example.com smart_proxy_dynflow_core[14576]: /opt/rh/rh-ruby22/root/usr/share/gems/gems/bundler-1.7.8/lib/bundler.rb:327:in `read': Is a directory @ io_fread - foo (Errno::EISDIR)
Apr 03 16:23:54 sat62.egolov.example.com smart_proxy_dynflow_core[14576]: from /opt/rh/rh-ruby22/root/usr/share/gems/gems/bundler-1.7.8/lib/bundler.rb:327:in `block in read_file'
Apr 03 16:23:54 sat62.egolov.example.com smart_proxy_dynflow_core[14576]: from /opt/rh/rh-ruby22/root/usr/share/gems/gems/bundler-1.7.8/lib/bundler.rb:327:in `open'
Apr 03 16:23:54 sat62.egolov.example.com smart_proxy_dynflow_core[14576]: from /opt/rh/rh-ruby22/root/usr/share/gems/gems/bundler-1.7.8/lib/bundler.rb:327:in `read_file'
Apr 03 16:23:54 sat62.egolov.example.com smart_proxy_dynflow_core[14576]: from /opt/rh/rh-ruby22/root/usr/share/gems/gems/bundler-1.7.8/lib/bundler/definition.rb:56:in `initialize'
Apr 03 16:23:54 sat62.egolov.example.com smart_proxy_dynflow_core[14576]: from /opt/rh/rh-ruby22/root/usr/share/gems/gems/bundler-1.7.8/lib/bundler/dsl.rb:152:in `new'
Apr 03 16:23:54 sat62.egolov.example.com smart_proxy_dynflow_core[14576]: from /opt/rh/rh-ruby22/root/usr/share/gems/gems/bundler-1.7.8/lib/bundler/dsl.rb:152:in `to_definition'
Apr 03 16:23:54 sat62.egolov.example.com smart_proxy_dynflow_core[14576]: from /opt/rh/rh-ruby22/root/usr/share/gems/gems/bundler-1.7.8/lib/bundler/dsl.rb:11:in `evaluate'
Apr 03 16:23:54 sat62.egolov.example.com smart_proxy_dynflow_core[14576]: from /opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:14:in `parse_from_gemfile'
Apr 03 16:23:54 sat62.egolov.example.com smart_proxy_dynflow_core[14576]: from /opt/theforeman/tfm/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:35:in `system_require'
Apr 03 16:23:54 sat62.egolov.example.com smart_proxy_dynflow_core[14576]: from /opt/theforeman/tfm/root/usr/share/gems/gems/smart_proxy_dynflow_core-0.1.3/lib/smart_proxy_dynflow_core/bundler_helper.rb:22:in `require_groups'
Apr 03 16:23:54 sat62.egolov.example.com smart_proxy_dynflow_core[14576]: from /opt/theforeman/tfm/root/usr/share/gems/gems/smart_proxy_dynflow_core-0.1.3/lib/smart_proxy_dynflow_core/launcher.rb:25:in `load_settings!'
Apr 03 16:23:54 sat62.egolov.example.com smart_proxy_dynflow_core[14576]: from /opt/theforeman/tfm/root/usr/share/gems/gems/smart_proxy_dynflow_core-0.1.3/lib/smart_proxy_dynflow_core/launcher.rb:12:in `start'
Apr 03 16:23:54 sat62.egolov.example.com smart_proxy_dynflow_core[14576]: from /opt/theforeman/tfm/root/usr/share/gems/gems/smart_proxy_dynflow_core-0.1.3/lib/smart_proxy_dynflow_core/launcher.rb:8:in `launch!'
Apr 03 16:23:54 sat62.egolov.example.com smart_proxy_dynflow_core[14576]: from /opt/theforeman/tfm/root/usr/share/gems/gems/smart_proxy_dynflow_core-0.1.3/bin/smart_proxy_dynflow_core:32:in `<top (required)>'
Apr 03 16:23:54 sat62.egolov.example.com smart_proxy_dynflow_core[14576]: from /usr/bin/smart_proxy_dynflow_core:23:in `load'
Apr 03 16:23:54 sat62.egolov.example.com smart_proxy_dynflow_core[14576]: from /usr/bin/smart_proxy_dynflow_core:23:in `<main>'
Apr 03 16:23:54 sat62.egolov.example.com systemd[1]: smart_proxy_dynflow_core.service: control process exited, code=exited status=1
Apr 03 16:23:54 sat62.egolov.example.com systemd[1]: Failed to start Foreman smart proxy dynflow core service.
Apr 03 16:23:54 sat62.egolov.example.com systemd[1]: Unit smart_proxy_dynflow_core.service entered failed state.
Apr 03 16:23:54 sat62.egolov.example.com systemd[1]: smart_proxy_dynflow_core.service failed.

Expected results:
smart_proxy_dynflow_core is restarted

Additional info:
This does not happen if /foo is a regular file.

Comment 1 Evgeni Golov 2017-04-03 15:41:12 UTC
This is fixed upstream in bundler_exec since https://github.com/bundlerext/bundler_ext/commit/b80372c2b9ea5f10046b62a0a0f900225a3869a8

Foreman/Katello don't have this issue, as they are using a self-built rubygem-bundler_ext-0.4.1-1.el7.noarch.rpm

Can we also rebase the bundler_exec we ship in Satellite, please?

The trivial patch that fixes this issue is:
--- a/lib/bundler_ext/gemfile.rb
+++ b/lib/bundler_ext/gemfile.rb
@@ -35,7 +35,7 @@ def self.process(bundler_gemfile, env)
     def self.parse(gemfile, *groups)
       setup_env(gemfile)
       env = self.parse_env(groups)
-      gemfile = Bundler::Dsl.evaluate(gemfile,'foo',true)
+      gemfile = Bundler::Dsl.evaluate(gemfile, nil, true)
       process(gemfile, env)
     end
   end

Comment 3 Evgeni Golov 2017-04-04 09:14:22 UTC
Related BZ about the same issue in foreman-proxy: https://bugzilla.redhat.com/show_bug.cgi?id=1327738

Comment 5 Ivan Necas 2017-04-05 07:21:43 UTC
*** Bug 1327738 has been marked as a duplicate of this bug. ***

Comment 6 Evgeni Golov 2017-08-09 12:17:46 UTC
VERIFIED

Version Tested:
Satellite-6.3 Snap 10
rubygem-bundler_ext-0.4.1-3.el7sat.noarch
tfm-rubygem-bundler_ext-0.4.1-1.el7sat.noarch

[root@sat63-qa-rhel7-puppet4 ~]# mkdir /foo
[root@sat63-qa-rhel7-puppet4 ~]# systemctl restart smart_proxy_dynflow_core
[root@sat63-qa-rhel7-puppet4 ~]# systemctl status smart_proxy_dynflow_core
● smart_proxy_dynflow_core.service - Foreman smart proxy dynflow core service
   Loaded: loaded (/usr/lib/systemd/system/smart_proxy_dynflow_core.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2017-08-09 12:16:02 UTC; 1min 2s ago
     Docs: https://github.com/theforeman/smart_proxy_dynflow
  Process: 16329 ExecStart=/usr/bin/smart_proxy_dynflow_core -d -p /var/run/foreman-proxy/smart_proxy_dynflow_core.pid (code=exited, status=0/SUCCESS)
 Main PID: 16361 (ruby)
   CGroup: /system.slice/smart_proxy_dynflow_core.service
           └─16361 ruby /usr/bin/smart_proxy_dynflow_core -d -p /var/run/foreman-proxy/smart_proxy_dynflow_core.pid

Aug 09 12:16:01 sat63-qa-rhel7-puppet4.kangae.example.com systemd[1]: Starting Foreman smart proxy dynflow core service...
Aug 09 12:16:02 sat63-qa-rhel7-puppet4.kangae.example.com systemd[1]: Started Foreman smart proxy dynflow core service.

Comment 7 Bryan Kearney 2018-02-21 16:45:07 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.

For information on the advisory, and where to find the updated files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:0336

Comment 8 Bryan Kearney 2018-02-21 17:11:20 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.

For information on the advisory, and where to find the updated files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:0336