-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migration to Python3 #2839
Migration to Python3 #2839
Conversation
Hello teddyandrieux,My role is to assist you with the merge of this Status report is not available. |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list:
|
@@ -37,16 +37,12 @@ def declare_node( | |||
|
|||
@when(parsers.parse('we deploy the node "{node_name}"')) | |||
def deploy_node(host, ssh_config, version, node_name): | |||
accept_ssh_key = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems unrelated to this PR.
And if this is really useless, then the doc needs an update as well: https://metal-k8s.readthedocs.io/en/development-2.6/installation/expansion.html#id3
So maybe this should be done in a dedicated PR (and keep this one only about py3 migration)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you right, for the doc I think it's still good to have it as a pre-check for expansion.
Edit: Oh it will not work anyway in the doc since we need python3 installed to have a working salt-ssh, ok I will update the doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the documentation but I think I will keep it in this PR since it's changes needed for Python3 migration even if it's not directly related
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could replace this command with the one suggested in docs (using --raw-shell
)? I think we added it here to make sure the test would fail early if there was any issue with the key, and also because it's good practice to do in tests exactly what we have in docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me this one was here just because it was needed at the beginning to accept the ssh public key of the new node.
Anyway right I can add this check here like in the doc
05ac2c6
to
3c443e0
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list:
|
/after_pull_request 2850 |
3c443e0
to
db25db6
Compare
Branches have divergedThis pull request's source branch To avoid any integration risks, please re-synchronize them using one of the
Note: If you choose to rebase, you may have to ask me to rebuild |
db25db6
to
1338ae2
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
928b1ea
to
e220bc6
Compare
@@ -37,16 +37,12 @@ def declare_node( | |||
|
|||
@when(parsers.parse('we deploy the node "{node_name}"')) | |||
def deploy_node(host, ssh_config, version, node_name): | |||
accept_ssh_key = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could replace this command with the one suggested in docs (using --raw-shell
)? I think we added it here to make sure the test would fail early if there was any issue with the key, and also because it's good practice to do in tests exactly what we have in docs.
1f7e4dc
to
ed2482f
Compare
280492d
to
1ca977e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only really minor comments, otherwise LGTM! Will manually test as well
21327b5
to
f08fd55
Compare
/approve |
Conflict with a changeset in the queueThe changeset in this pull request conflicts with another changeset This changeset has not been added to the queue. The following options are set: approve |
With Python3 we can no longer use `cmp` in `sort` and `sorted` function so use our salt module `metalk8s.cmp_sorted` in Downgrade orchestrate if we are running with Python3, so that it works well with Python2 and Pyton3 Refs: #2203
In the past a `salt-ssh` command was needed prior to start the expansions to accept the ssh key but it's not longer needed so remove it. Instead do a simple `salt-ssh --raw-shell` command to check that salt-ssh work properly
Right now `salt.function` salt state module do not handle `roster` for ssh and `raw_shell`, create a custom salt state module to run a `saltutil.cmd` with all kwargs input so that we support `roster` and `raw_shell` Sees: saltstack/salt#58662
Change salt-master image to use Python3 salt-master package and also install Python3 dependencies, embed Python3 salt-minion version instead of Python2. In order to install Python3 salt-minion we need: - to install python3 - to install python36-rpm as by default version comparaison for package installation is wrong - to install python3 on nodes for being able to use `salt-ssh` Sees: saltstack/salt#58039 Sees: saltstack/salt#57972 Fixes: #2203
- removes `salttesting` dependency - migrates away from deprecated `TestCase` methods - migrates `Mock` objects call args checks
We need to pass `\;` to the `isoinfo` binary for reading file contents from an ISO archive, but this escape sequence is not valid in Python, and Python 3 warns about it. We could have escaped the backslash, but instead rely on the raw string notation for Python 3 (`r'my \escaped sequence'`).
Since we migrate from Python2 to Python3 a "classic" salt states cannot handle it properly as the Python version change during the state execution. Add a dedicated orchestrate that handle the migration from Salt Python2 to Salt Python3 and also the migration from Salt Python3 to Salt Python2, call this new orchestrate during Upgrade and Downgrade if needed Refs: #2203
Since we migrate to Salt Python3 we have Jinja 2.11 so we can use `loop.previtem` instead of ugly hack using a jinja variable. NOTE: This hack is still needed in downgrade orchestrate when we downgrade to `2.6.x` as we are running with Salt master metalk8s-2.6.x that use Salt Python2 and Jinja 2.7 Refs: #2203
In `deploy_node` orchestrate, before this commit, during upgrade and downgrade the `Install etcd node` state is called even if the Salt upgrade/downgrade failed. This commit just add a require on this etcd state
Solutions YAML files contains some non-breaking space characters inside some Jinja formula `{{ }}` that make Salt Python3 rendering fail. NOTE: Those non-breaking space characters did not break Jinja2.7 used by Salt in Python2 that's why we didn't see any issue because of this before
Add an entry in changelog file about Salt migration to Python3 and bump to Salt version 3002.2 Refs: #2203
e42a510
to
0d1cb84
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list:
The following options are set: approve |
In the queueThe changeset has received all authorizations and has been added to the The changeset will be merged in:
The following branches will NOT be impacted:
There is no action required on your side. You will be notified here once IMPORTANT Please do not attempt to modify this pull request.
If you need this pull request to be removed from the queue, please contact a The following options are set: approve |
I have successfully merged the changeset of this pull request
The following branches have NOT changed:
Please check the status of the associated issue None. Goodbye teddyandrieux. |
Component:
'salt', 'build'
Context:
#2203
Summary:
3002.2
Acceptance criteria:
Fixes: #2203