Bug 1378495

Summary: [RFE] Do not change OStree origin refspec
Product: Red Hat Enterprise Linux 7 Reporter: Micah Abbott <miabbott>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: alejandro.cortina2, bbreard, bcourt, bkearney, csnyder, khowell, miabbott, redakkan, skallesh, tomckay, walters
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.18.5-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 19:20:42 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:

Comment 2 Colin Walters 2016-10-07 15:56:09 UTC
This is far too abstract for me - what would be in different remotes (presumably different products)?

Or is this alternative versions of existing products?

Would these new products have their own install media?

Comment 3 Micah Abbott 2016-10-10 14:40:06 UTC
I don't have the answers for those questions.  But I'm hoping that someone like bbreard will.

Ben, can you speak to the need for having remotes that cover alternate subscriptions besides RHEL Server?  Subhendu made the original comment here, 

https://bugzilla.redhat.com/show_bug.cgi?id=1226007#c6

...but it is light on details.

Comment 4 Chris Snyder 2017-03-14 16:04:44 UTC
As per discussion with cgwalters, it is no longer necessary for subscription-manager to update the origin refspec. As such subscription-manager should not have any other work necessary for implementation of this feature.

The PR attached above is the change in subscription-manager to stop manipulating .origin files in this way.

The PR below is the work on the OStree side to allow subscription-manager to not have to change the origin refspec: https://github.com/ostreedev/ostree/pull/627

Changing the title of this to match the work done.

After this change, subscription-manager will add remotes found in through ostree content delivered with a subscription but will not change the origin refspec currently deployed as a result of it. Changes to what branch a machine is on are done using the OStree tools.

Please see myself and / or cgwalters with any questions.

Comment 6 John Sefler 2017-04-20 22:31:38 UTC
The former RHEL7.3 version of subscription-manager-plugin-ostree included a script called giwrapper.py that was used to locate the current --deployed-origin file.  Knowing the path to this file was needed in order to change the refspec declared within to a newly defined remote as entitled via a newly attached subscription that provides a content set of type="ostree".

Here was the file...
[root@jsefler-rhel7 ~]# rpm -q subscription-manager-plugin-ostree
subscription-manager-plugin-ostree-1.17.15-1.el7.x86_64  <====== RHEL73 VERSION
[root@jsefler-rhel7 ~]# rpm -ql subscription-manager-plugin-ostree | grep -e gi_wrapper.py$
/usr/lib/python2.7/site-packages/subscription_manager/plugin/ostree/gi_wrapper.py
[root@jsefler-rhel7 ~]# cat /usr/lib/python2.7/site-packages/subscription_manager/plugin/ostree/gi_wrapper.py
#
# Copyright (c) 2014 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
# along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
#
# Red Hat trademarks are not licensed under GPLv2. No permission is
# granted to use or replicate Red Hat trademarks that are incorporated
# in this software or its documentation.
#

"""
Standalone script to fetch information about the current OSTree.

Uses pygobject3 to introspect. This does not work with gobject2 which
we use in a couple locations in core subscription-manager, so instead
we shell out to this script to get the required information.
"""

from optparse import OptionParser
from gi.repository import OSTree

parser = OptionParser()

parser.add_option("--deployed-origin", dest="deployed_origin",
    default=False, action="store_true",
    help="Print the path to the current deployed OSTree origin file.")

(options, args) = parser.parse_args()

if options.deployed_origin:
    sysroot = OSTree.Sysroot.new_default()
    sysroot.load(None)
    booted = sysroot.get_booted_deployment()
    if booted:
        deploydir = sysroot.get_deployment_directory(booted)
        print(sysroot.get_deployment_origin_path(deploydir).get_path())



After upgrading subscription-manager-plugin-ostree to the current version targeted for RHEL74,...
[root@jsefler-rhel7 ~]# rpm -q subscription-manager-plugin-ostree
subscription-manager-plugin-ostree-1.19.8-1.el7.x86_64
[root@jsefler-rhel7 ~]# rpm -ql subscription-manager-plugin-ostree | grep -e gi_wrapper.py$
[root@jsefler-rhel7 ~]# 

The gi_wrapper.py script is no longer provided by subscription-manager-plugin-ostree and therefore subscription-manager-plugin-ostree can not possibly make changes to the origin refspec in the currently --deployed-origin file since it does not know where the filepath is anymore.

VERIFIED: subscription-manager-plugin-ostree can not change ostree origin refspec

Comment 7 errata-xmlrpc 2017-08-01 19:20:42 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-2017:2083

Comment 8 Rehana 2020-03-16 15:30:22 UTC
*** Bug 1193208 has been marked as a duplicate of this bug. ***