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 1651068

Summary: foreman-maintain service module failed to find satellite/version.rb on capsule
Product: Red Hat Satellite Reporter: Nikhil Kathole <nkathole>
Component: Satellite MaintainAssignee: Anurag Patel <apatel>
Status: CLOSED ERRATA QA Contact: Nikhil Kathole <nkathole>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5.0CC: ajoseph, apatel, bkearney, inecas, kgaikwad, mbacovsk, sudharsan.omprakash
Target Milestone: 6.7.0Keywords: Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: rubygem-foreman_maintain-0.5.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-14 12:58:36 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 Nikhil Kathole 2018-11-19 06:00:15 UTC
Description of problem:

foreman-maintain service status/start/restart failed with error on capsule

# foreman-maintain service start
No such file or directory - /usr/share/foreman/lib/satellite/version.rb
# foreman-maintain service restart
No such file or directory - /usr/share/foreman/lib/satellite/version.rb

# foreman-maintain service status
Running Status Services
================================================================================
Get status of applicable services: 
Displaying the following service(s):

rh-mongodb34-mongod, qdrouterd, qpidd, squid, pulp_celerybeat, pulp_resource_manager, pulp_streamer, pulp_workers, smart_proxy_dynflow_core, dynflowd, goferd, httpd, puppetserver, foreman-proxy
/                                                                     [FAIL]    
No such file or directory - /usr/share/foreman/lib/satellite/version.rb
--------------------------------------------------------------------------------
Scenario [Status Services] failed.

The following steps ended up in failing state:

  [service-status]

Resolve the failed steps and rerun
the command. In case the failures are false positives,
use --whitelist="service-status"


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

# rpm -qa | grep capsule
satellite-capsule-6.5.0-4.beta.el7sat.noarch

# rpm -qa | grep maintain
rubygem-foreman_maintain-0.3.0-1.el7sat.noarch


How reproducible: always

Steps to Reproduce:
1. foreman-maintain service status

Actual results:
Failed with error No such file or directory - /usr/share/foreman/lib/satellite/version.rb and

foreman-maintain.log showed

D, [2018-11-19 00:54:20-0500 #38665] DEBUG -- : Running command rpm -q 'satellite' --queryformat="%{VERSION}" with stdin nil
D, [2018-11-19 00:54:20-0500 #38665] DEBUG -- : output of the command:
 package satellite is not installed
E, [2018-11-19 00:54:20-0500 #38665] ERROR -- : No such file or directory - /usr/share/foreman/lib/satellite/version.rb (Errno::ENOENT)
/usr/share/gems/gems/foreman_maintain-0.3.0/definitions/features/downstream.rb:99:in `read'
/usr/share/gems/gems/foreman_maintain-0.3.0/definitions/features/downstream.rb:99:in `version_from_source'
/usr/share/gems/gems/foreman_maintain-0.3.0/definitions/features/downstream.rb:19:in `current_version'
/usr/share/gems/gems/foreman_maintain-0.3.0/definitions/features/downstream.rb:11:in `less_than_version?'
/usr/share/gems/gems/foreman_maintain-0.3.0/definitions/features/service.rb:10:in `handle_services'
/usr/share/gems/gems/foreman_maintain-0.3.0/definitions/procedures/service/base.rb:22:in `block in run_service_action'
/usr/share/gems/gems/foreman_maintain-0.3.0/lib/foreman_maintain/reporter/cli_reporter.rb:141:in `with_spinner'
/usr/share/gems/gems/foreman_maintain-0.3.0/definitions/procedures/service/base.rb:21:in `run_service_action'
/usr/share/gems/gems/foreman_maintain-0.3.0/definitions/procedures/service/status.rb:14:in `run'
/usr/share/gems/gems/foreman_maintain-0.3.0/lib/foreman_maintain/executable.rb:139:in `__run__'
/usr/share/gems/gems/foreman_maintain-0.3.0/lib/foreman_maintain/runner/execution.rb:83:in `block (2 levels) in run'
/usr/share/gems/gems/foreman_maintain-0.3.0/lib/foreman_maintain/runner/execution.rb:107:in `capture_errors'
/usr/share/gems/gems/foreman_maintain-0.3.0/lib/foreman_maintain/runner/execution.rb:82:in `block in run'
/usr/share/gems/gems/foreman_maintain-0.3.0/lib/foreman_maintain/runner/execution.rb:101:in `with_metadata_calculation'
/usr/share/gems/gems/foreman_maintain-0.3.0/lib/foreman_maintain/runner/execution.rb:81:in `run'
/usr/share/gems/gems/foreman_maintain-0.3.0/lib/foreman_maintain/runner.rb:116:in `run_step'
/usr/share/gems/gems/foreman_maintain-0.3.0/lib/foreman_maintain/runner.rb:105:in `run_steps'
/usr/share/gems/gems/foreman_maintain-0.3.0/lib/foreman_maintain/runner.rb:98:in `execute_scenario_steps'
/usr/share/gems/gems/foreman_maintain-0.3.0/lib/foreman_maintain/runner.rb:51:in `run_scenario'
/usr/share/gems/gems/foreman_maintain-0.3.0/lib/foreman_maintain/runner.rb:32:in `block in run'
/usr/share/gems/gems/foreman_maintain-0.3.0/lib/foreman_maintain/runner.rb:31:in `each'
/usr/share/gems/gems/foreman_maintain-0.3.0/lib/foreman_maintain/runner.rb:31:in `run'
/usr/share/gems/gems/foreman_maintain-0.3.0/lib/foreman_maintain/cli/base.rb:47:in `run_scenario'
/usr/share/gems/gems/foreman_maintain-0.3.0/lib/foreman_maintain/cli/service_command.rb:66:in `execute'
/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
/usr/share/gems/gems/foreman_maintain-0.3.0/lib/foreman_maintain/cli.rb:27:in `run'
/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run'
/usr/share/gems/gems/foreman_maintain-0.3.0/bin/foreman-maintain:15:in `<top (required)>'
/usr/bin/foreman-maintain:23:in `load'
/usr/bin/foreman-maintain:23:in `<main>'


Expected results: foreman-maintain service start/restart/status should work.


Additional info: It works fine with satellite.

Comment 3 Martin Bacovsky 2018-11-19 15:05:49 UTC
This is happening on Capsule with rubygem-foreman installed by mistake. It is not correct and supported setup. I'll keep the bug to track how we are handling the failure of version detection.
Priority and severity set to low.

Comment 4 Martin Bacovsky 2018-11-19 15:07:35 UTC
Created redmine issue https://projects.theforeman.org/issues/25508 from this bug

Comment 7 sudharsan.omprakash 2020-01-17 01:00:31 UTC
Hello There,

I was able to resolve this similar this today. Please see below for the details


High level Details:

I was trying to upgrade Satellite and Capsule from 6.4.3 to 6.5.2.1 . Satellite upgrade was successful and while performing Capsule upgrade i ran into issue. Then i noticed, my capsule was not installed correctly. Issue was katello package and its dependencies were installed manually so remove and did automatic install.


Issue:

[root@capsule-sat]# satellite-installer --scenario capsule --upgrade Resetting puppet server version param...
Upgrading, to monitor the progress on all related services, please do:
  foreman-tail | tee upgrade-$(date +%Y-%m-%d-%H%M).log Upgrade Step: stop_services...
Redirecting to 'foreman-maintain service'
/usr/share/gems/gems/foreman_maintain-0.3.3/definitions/features/downstream.rb:99:in `read': No such file or directory - /usr/share/foreman/lib/satellite/version.rb (Errno::ENOENT)
        from /usr/share/gems/gems/foreman_maintain-0.3.3/definitions/features/downstream.rb:99:in `version_from_source'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/definitions/features/downstream.rb:19:in `current_version'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/definitions/features/downstream.rb:23:in `current_minor_version'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/definitions/procedures/candlepin/delete_orphaned_records_from_env_content.rb:10:in `block (2 levels) in <class:DeleteOrphanedRecordsFromEnvContent>'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/concerns/metadata.rb:226:in `instance_exec'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/concerns/metadata.rb:226:in `block in evaluate_confines'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/concerns/metadata.rb:225:in `each'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/concerns/metadata.rb:225:in `all?'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/concerns/metadata.rb:225:in `evaluate_confines'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/concerns/metadata.rb:200:in `present?'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/detector.rb:53:in `block in find_present_classes'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/detector.rb:52:in `each'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/detector.rb:52:in `reduce'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/detector.rb:52:in `find_present_classes'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/detector.rb:46:in `available_procedures'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain.rb:114:in `allowed_available_procedures'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/cli/advanced/procedure/run_command.rb:7:in `<class:RunCommand>'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/cli/advanced/procedure/run_command.rb:6:in `<module:Procedure>'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/cli/advanced/procedure/run_command.rb:5:in `<module:Cli>'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/cli/advanced/procedure/run_command.rb:4:in `<module:ForemanMaintain>'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/cli/advanced/procedure/run_command.rb:3:in `<top (required)>'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/cli/advanced/procedure_command.rb:1:in `<top (required)>'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/cli/advanced_command.rb:1:in `<top (required)>'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/lib/foreman_maintain/cli.rb:8:in `<top (required)>'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/share/gems/gems/foreman_maintain-0.3.3/bin/foreman-maintain:14:in `<top (required)>'
        from /bin/foreman-maintain:23:in `load'
        from /bin/foreman-maintain:23:in `<main>'
katello-service stop failed! Check the output for error!
Upgrade step stop_services failed. Check logs for more information.


Solution:

* Performed katello-remove
* Performed subscription manager re-registration - (As it automatically removed in my case) - subscription-manager register --org="mydomain" --activationkey="ak-key" --force
* yum install satellite-capsule - installed the satellite-capsule
* satellite-installer --scenario capsule --foreman-proxy-content-parent-fqdn "satellite-server" --foreman-proxy-register-in-foreman "true" --foreman-proxy-foreman-base-url "https://satellite-server" --foreman-proxy-trusted-hosts "satellite-server" --foreman-proxy-trusted-hosts "capsule-sat" --foreman-proxy-oauth-consumer-key "laalsdjlfjasldllksajd" --foreman-proxy-oauth-consumer-secret "asdlkjf;aksjd;flkaljsdfa;sdfjals" --foreman-proxy-content-certs-tar "/root/capsule-sat-certs.tar" --puppet-server-foreman-url "https://satellite-server"
* foreman-maintain service status 

It worked for me. Please try with your case and share your feedback. 

Root Cause:
* katello package and its dependencies were installed manually

Comment 8 Kavita 2020-01-17 13:12:57 UTC
Available in foreman-maintain version >= 0.5.0. Moving to ON_QA

Comment 9 Nikhil Kathole 2020-01-19 14:49:01 UTC
VERIFIED

Version tested:
# rpm -qa | grep maintain
rubygem-foreman_maintain-0.5.1-1.el7sat.noarch
satellite-maintain-0.0.1-1.el7sat.noarch

# rpm -q satellite-capsule
satellite-capsule-6.7.0-5.beta.el7sat.noarch

Steps:
1. Install capsule
2. yum install katello
3. foreman-maintain service status

Though issue was reproducible on not supported setup of capsule, foreman-maintain's new version handles the error successfully.

# foreman-maintain service status
Running Status Services
================================================================================
Get status of applicable services: 
Displaying the following service(s):

rh-mongodb34-mongod, qdrouterd, qpidd, squid, pulp_celerybeat, pulp_resource_manager, pulp_streamer, pulp_workers, tomcat, dynflowd, goferd, httpd, puppetserver
/                                                                     [FAIL]    
No such file or directory - /usr/share/foreman/lib/satellite/version.rb
--------------------------------------------------------------------------------
Scenario [Status Services] failed.

The following steps ended up in failing state:

  [service-status]

Resolve the failed steps and rerun
the command. In case the failures are false positives,
use --whitelist="service-status"


[root@qe-capsule-feature-rhel7 ~]# rpm -qa | grep maintain
rubygem-foreman_maintain-0.4.10-1.el7sat.noarch
satellite-maintain-0.0.1-1.el7sat.noarch

[root@qe-capsule-feature-rhel7 ~]# yum upgrade rubygem-foreman_maintain
Loaded plugins: enabled_repos_upload, langpacks, package_upload, product-id, search-disabled-repos, subscription-manager
Default_Organization_Sat6Capsule7_capsule7                                                                                 | 2.5 kB  00:00:00     
Default_Organization_Sat6Maintain7_maintain7                                                                               | 2.1 kB  00:00:00     
Default_Organization_Sat6Tools7_sat6tool7                                                                                  | 2.1 kB  00:00:00     
Sat6-CI_Red_Hat_Satellite_6_7_Composes_Satellite_6_7_RHEL7                                                                 | 2.5 kB  00:00:00     
Sat6-CI_Red_Hat_Satellite_6_7_Composes_Satellite_Tools_6_7_RHEL7                                                           | 2.1 kB  00:00:00     
rhel-7-server-ansible-2-rpms                                                                                               | 2.3 kB  00:00:00     
rhel-7-server-rpms                                                                                                         | 2.0 kB  00:00:00     
rhel-server-rhscl-7-rpms                                                                                                   | 2.0 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package rubygem-foreman_maintain.noarch 1:0.4.10-1.el7sat will be updated
---> Package rubygem-foreman_maintain.noarch 1:0.5.1-1.el7sat will be an update
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================
 Package                             Arch              Version                      Repository                                               Size
==================================================================================================================================================
Updating:
 rubygem-foreman_maintain            noarch            1:0.5.1-1.el7sat             Default_Organization_Sat6Maintain7_maintain7            141 k

Transaction Summary
==================================================================================================================================================
Upgrade  1 Package

Total download size: 141 k
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for Default_Organization_Sat6Maintain7_maintain7
rubygem-foreman_maintain-0.5.1-1.el7sat.noarch.rpm                                                                         | 141 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : 1:rubygem-foreman_maintain-0.5.1-1.el7sat.noarch                                                                               1/2 
  Cleanup    : 1:rubygem-foreman_maintain-0.4.10-1.el7sat.noarch                                                                              2/2 
Uploading Package Profile
Loaded plugins: langpacks, product-id, subscription-manager
Loaded plugins: langpacks, product-id, subscription-manager
Loaded plugins: langpacks, product-id, subscription-manager
Loaded plugins: langpacks, product-id, subscription-manager
Loaded plugins: langpacks, product-id, subscription-manager
Loaded plugins: langpacks, product-id, subscription-manager
  Verifying  : 1:rubygem-foreman_maintain-0.5.1-1.el7sat.noarch                                                                               1/2 
  Verifying  : 1:rubygem-foreman_maintain-0.4.10-1.el7sat.noarch                                                                              2/2 

Updated:
  rubygem-foreman_maintain.noarch 1:0.5.1-1.el7sat                                                                                                

Complete!
Uploading Enabled Repositories Report
Loaded plugins: langpacks, product-id, subscription-manager
[root@qe-capsule-feature-rhel7 ~]# foreman-maintain service status
Running Status Services
================================================================================
Get status of applicable services: 
Displaying the following service(s):

rh-mongodb34-mongod, qdrouterd, qpidd, squid, pulp_celerybeat, pulp_resource_manager, pulp_streamer, pulp_workers, tomcat, dynflowd, goferd, httpd, puppetserver
- displaying rh-mongodb34-mongod                                                
● rh-mongodb34-mongod.service - High-performance, schema-free document-oriented database
   Loaded: loaded (/usr/lib/systemd/system/rh-mongodb34-mongod.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2020-01-18 20:11:00 EST; 13h ago
 Main PID: 16441 (mongod)
    Tasks: 61
   CGroup: /system.slice/rh-mongodb34-mongod.service
           └─16441 /opt/rh/rh-mongodb34/root/usr/bin/mongod -f /etc/opt/rh/rh-mongodb34/mongod.conf run

Jan 19 02:11:02 qe-capsule-feature-rhel7.capqe.lab.eng.rdu2.redhat.com mongod.27017[16441]: [conn46] build index on: pulp_database.consumer_history properties: { v: 2, key: { type: -1 }, name: "type_-1", ns: "pulp_database.consumer_history", background: true }
Jan 19 02:11:02 qe-capsule-feature-rhel7.capqe.lab.eng.rdu2.redhat.com mongod.27017

<trimmed>

Comment 12 errata-xmlrpc 2020-04-14 12:58:36 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/RHBA-2020:1442