Skip to content

Sodium deprecations - #57370

Merged
dwoz merged 13 commits into
saltstack:masterfrom
waynew:sodium-deprecations
May 22, 2020
Merged

dwoz merged 13 commits into
saltstack:masterfrom
waynew:sodium-deprecations

Conversation

@waynew

@waynew waynew commented May 19, 2020

Copy link
Copy Markdown
Contributor

What does this PR do?

Removes all the places that were marked with 'warn_until` and Sodium

What issues does this PR fix or reference?

Several - all referenced in the commit messages

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes

@waynew
waynew requested a review from a team as a code owner May 19, 2020 03:20
@ghost
ghost requested review from DmitryKuzmenko and removed request for a team May 19, 2020 03:20
s0undt3ch
s0undt3ch previously approved these changes May 19, 2020
Comment thread salt/modules/napalm_network.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could take the time and stop using six.string_types in favor or str on places where code is updated.

DmitryKuzmenko
DmitryKuzmenko previously approved these changes May 19, 2020
@DmitryKuzmenko

Copy link
Copy Markdown
Contributor

The tests failures are related BTW.

@waynew
waynew dismissed stale reviews from DmitryKuzmenko and s0undt3ch via cf5adbd May 20, 2020 17:43
@waynew
waynew force-pushed the sodium-deprecations branch from cf5adbd to bee3442 Compare May 20, 2020 17:44
@sagetherage sagetherage added the ZRelease-Sodium retired label label May 20, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I can see the keystone module was deprecated and have to be removed but I don't see removal of the module in this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's been punted to the next release - the state was not deprecated, and hasn't been re-written to take advantage of the keystoneng module. Looks like I need to put the docs back, though 😝

waynew added 11 commits May 21, 2020 10:39
Closes saltstack#57362

These arguments are no longer useful, since we no longer support using
NAPALM native templates.
It was deprecated and slated for removal in Sodium. Closes saltstack#57363
Closes saltstack#57366

Parameter has been renamed to `refresh`
Closes saltstack#57367

sdecode and sdecode_if_string functionalities have both been moved to
decode.
Closes saltstack#57368

- removed obsolete .destroy methods from zeromq channels
- removed winexe support from salt.utils.cloud
- removed obsolete override_name from
  salt.utils.context.NamespacedDictWrapper
- removed obsolete `show_ipv4` parameter from salt.utils.minions
- removed impacket support from salt.utils.smb
- removed obsolete salt.transport.Channel, and fixed test.
@waynew
waynew force-pushed the sodium-deprecations branch from 837302f to 90eee56 Compare May 21, 2020 15:40
@waynew

waynew commented May 21, 2020

Copy link
Copy Markdown
Contributor Author

re-run full all

@dwoz

dwoz commented May 22, 2020

Copy link
Copy Markdown
Contributor

re-run ubuntu

@dwoz
dwoz merged commit ee181c9 into saltstack:master May 22, 2020
@max-arnold max-arnold mentioned this pull request Jul 12, 2020
1 task done
@max-arnold

Copy link
Copy Markdown
Contributor

The old module.run syntax deprecation note was still pointing to 3001. Fixed in 5494619

dwoz pushed a commit that referenced this pull request Jul 13, 2026
Two failures made `netusers.managed` / `users.set_users` unusable on NAPALM
(proxy) minions:

- `netusers.managed` passes its optional `defaults` to `_expand_users` as
  `common_users`, then does `copy.deepcopy(common_users).update(...)`. With no
  `defaults` (the common case) that is `copy.deepcopy(None).update(...)`, which
  raises `AttributeError: 'NoneType' object has no attribute 'update'`.

- `users.set_users` / `users.delete_users` call `net.load_template("set_users",
  ...)` with a bare template name. `net.load_template` used to route bare names
  into NAPALM's own renderer, but that path was removed in the Sodium release
  (#57370) -- whose own deprecation warning explicitly told `netusers`/`netntp`/
  `netsnmp` users they could ignore it. The bare name now falls through to the
  fileserver as `Local file source set_users does not exist`.

`_expand_users` now treats a missing `defaults` as `{}`. `set_users` /
`delete_users` resolve the NAPALM-shipped per-driver template (`set_users.j2` /
`delete_users.j2`, which NAPALM still ships, searched along the driver class
MRO) to an absolute path and render it through the Salt pipeline, and return a
clear message when a driver ships no such template.

Because the crash previously masked it, `managed` now refuses to proceed when
the expanded user set is empty rather than removing (and committing) every
account on the device -- an admin-lockout foot-gun, e.g. an empty pillar lookup.

Validated end-to-end against a live Juniper EX3400 (Junos 23.4R2) over NETCONF:
users are rendered, committed, confirmed on-device, and removed again.
dwoz pushed a commit that referenced this pull request Aug 14, 2026
napalm_ntp (set_peers/set_servers/delete_peers/delete_servers), napalm_snmp
(update_config/remove_config) and napalm_probes (set_probes/delete_probes/
schedule_probes) all call net.load_template with a bare template name (e.g.
"set_ntp_peers"). net.load_template used to route bare names into NAPALM's own
renderer, but that path was removed in the Sodium release (#57370) -- whose own
deprecation warning explicitly told netntp/netsnmp/netusers users to ignore it.
The bare name now falls through to the fileserver as "Local file source
set_ntp_peers does not exist", so every one of these functions fails.

Lift the resolver introduced for users in #62170 into a shared
salt.utils.napalm.template_path (walks the driver class MRO + inspect.getfile,
catching TypeError/OSError, returns None when the driver ships no such template)
plus salt.utils.napalm.template_not_available (standard failure payload). The
three modules resolve the driver's NAPALM-shipped template to an absolute path
and render it through the Salt pipeline, or return the clear failure message.
template_not_available also closes the per-call connection a non-always-alive
proxy/minion opened, since it short-circuits net.load_template (which would
otherwise close it).

napalm_users is intentionally left to #62170; a follow-up dedups its local
resolver onto the shared one.

Validated on a live Juniper EX3400 (Junos 23.4R2): ntp.set_servers renders,
commits, is confirmed in the device config, and is removed again. (NAPALM's
junos snmp/probes templates still use py2 dict.iteritems() and need modernizing
upstream in NAPALM; the NTP templates are py3-clean.)

New tests/pytests/unit/utils/test_napalm.py covers the resolver (MRO
concrete-over-base precedence, base fall-through, OSError/TypeError skip, missing
-> None) and the close behaviour; test_ntp/test_snmp are rewritten and
test_probes added with routing tests asserting the correct template name, the
resolved path, forwarded flags, and inherit_napalm_device identity.
dwoz pushed a commit that referenced this pull request Oct 27, 2026
napalm_ntp (set_peers/set_servers/delete_peers/delete_servers), napalm_snmp
(update_config/remove_config) and napalm_probes (set_probes/delete_probes/
schedule_probes) all call net.load_template with a bare template name (e.g.
"set_ntp_peers"). net.load_template used to route bare names into NAPALM's own
renderer, but that path was removed in the Sodium release (#57370) -- whose own
deprecation warning explicitly told netntp/netsnmp/netusers users to ignore it.
The bare name now falls through to the fileserver as "Local file source
set_ntp_peers does not exist", so every one of these functions fails.

Lift the resolver introduced for users in #62170 into a shared
salt.utils.napalm.template_path (walks the driver class MRO + inspect.getfile,
catching TypeError/OSError, returns None when the driver ships no such template)
plus salt.utils.napalm.template_not_available (standard failure payload). The
three modules resolve the driver's NAPALM-shipped template to an absolute path
and render it through the Salt pipeline, or return the clear failure message.
template_not_available also closes the per-call connection a non-always-alive
proxy/minion opened, since it short-circuits net.load_template (which would
otherwise close it).

napalm_users is intentionally left to #62170; a follow-up dedups its local
resolver onto the shared one.

Validated on a live Juniper EX3400 (Junos 23.4R2): ntp.set_servers renders,
commits, is confirmed in the device config, and is removed again. (NAPALM's
junos snmp/probes templates still use py2 dict.iteritems() and need modernizing
upstream in NAPALM; the NTP templates are py3-clean.)

New tests/pytests/unit/utils/test_napalm.py covers the resolver (MRO
concrete-over-base precedence, base fall-through, OSError/TypeError skip, missing
-> None) and the close behaviour; test_ntp/test_snmp are rewritten and
test_probes added with routing tests asserting the correct template name, the
resolved path, forwarded flags, and inherit_napalm_device identity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ZRelease-Sodium retired label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants