saltstack-formulas/salt-formula

default salt.pkgrepo version - py2 or py3

noelmcloughlin opened this issue · 6 comments

After running salt-bootstrap with python 3 support the saltstack repo is correctly defined.

$ cat salt-bootstrap /etc/apt/sources.list.d/saltstack.list 
deb https://repo.saltstack.com/py3/ubuntu/18.04/amd64/latest bionic main

$ head /usr/bin/salt-api 
#!/usr/bin/python3

However subsequent runs of salt-formula.pkgrepo overwrite wrong repo value.

$ cat salt-bootstrap /etc/apt/sources.list.d/saltstack.list 
deb http://repo.saltstack.com/apt/ubuntu/18.04/amd64/latest bionic main

The system gets broken if apt-get install salt-????? is subsequently and usually inadvertently run, because python scripts in /usr/bin are updated to python2.

$ head /usr/bin/salt-api 
#!/usr/bin/python2

This is the problem default value:
$ cat salt-bootstrap /etc/apt/sources.list.d/saltstack.list

key_url: 'https://repo.saltstack.com/{{ py_ver_dir }}/{{ os_lower }}/{{ osrelease }}/amd64/{{ salt_release }}/SALTSTACK-GPG-KEY.pub'

Maybe the following pillar.example lines should be added to default.yaml.

  # Set this to 'py3' to install the Python 3 packages.
  # If this is not set, the Python 2 packages will be installed by default.
  py_ver: 'py3'
myii commented

@noelmcloughlin This is unfortunate. This py2 to py3 really needs a timeline set (in terms of this org). The issue is that there are py2-based LTS OSes still in support for a while yet. How often are servers updated to the latest and greatest? I wouldn't be surprised to find a sizeable proportion still "holding on".

In terms of this formula, when py_ver was introduced, only py2 packages were being installed here (ref). So to prevent disruption, we still defaulted to py2. Switching to py3 will be a breaking change, so must be considered carefully. Let's hope some of the others chime in with their thoughts.

I'm fine leaving as is since I can override by pillar data. The general question is whether we should be nudging people towards python3 via defaults - in this formula and in wider community - the pillar data can be used for less important py2 use case and defaults set to py3 which is more important going forward?

myii commented

@noelmcloughlin The biggest problem is that py2 is the established default. So changing that to py3 is introducing a breaking change, which could lead to some serious issues. Since we've got until Sodium (at the very least), I think we ought to keep py2 as default for a while yet.

I'm not asking about dropping py2 support. The computer industry already made its decision to change default to py3. All well maintained OS have changed default to py3 - Linux, MacOS (and maybe Windows) - but still support py2. Changing default to current industry standard should happen asap?

py2 was the established default until recently is my point. py3 is now established default.

myii commented

@noelmcloughlin To be clear, in a personal capacity, I've been Python 3 wherever possible. However, in terms of this issue, there are a couple of angles that I'm coming from:

  • Established default for this formula:
    • This formula has been based on Python 2 from the beginning.
    • However many people are using this, it has been with Python 2 as the default.
    • Any change to this (not arguing that the change shouldn't be made), is still a breaking change.
  • Position of SaltStack Formulas within the overall ecosystem:
    • Due to the nature of this organisation, we're always going to have to follow the lead from upstream Salt.
    • We're always constricted by having to support older versions, of OSes and Salt itself (until they EOL).
    • In that subset of minions, what are the Py2/Py3 metrics? Unfortunately, we have no way of determining that.
    • There are still some OSes that don't have Salt Py3 support, such as Fedora (David Murphy on Slack):
      • understand now, could be related to this https://bugzilla.redhat.com/show_bug.cgi?id=1723207
      • in meeting at moment, but will check into it after. Salt in Fedora at the moment is Python 2 based due to issue with Tornado >= 5 on Python 3, hopefully fixed in the Neon Release