2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-08-27 17:16:42 +00:00
Commit Graph

177 Commits

Author SHA1 Message Date
Markus Hilger 644843b892 Remove unused imports and pointless f-string prefixes (F401, F541, E713)
Entirely mechanical, produced by `ruff check --fix --select F401,F541,E713`
and reviewed rather than taken on faith: deleting an import is only safe if
nothing imports it for its side effects or re-exports it.  None of the 19
removed names is referenced anywhere in its file, none appears in any string
literal, and none of the touched files uses eval, exec, globals() or
__import__, so there is no dynamic lookup that could reach them.
2026-08-10 05:32:00 +02:00
Markus Hilger b119de345b Remove shadowed duplicate definitions (F811)
Three names were defined twice in the same scope, so the first definition
was unreachable:

- lenovo OEM handler: two set_user_access methods, the second silently
  replacing the first.  That made the SMM privilege update dead code.  The
  conditions are mutually exclusive (is_fpc returns None once has_xcc is
  true), so merge both into the surviving method.
- redfish plugin handle_cert_authorities and prepfish
  disable_host_interface: byte identical copies, drop the redundant one.
2026-08-10 05:32:00 +02:00
Markus Hilger 8a3fce85c0 Fix undefined names (F821)
Every one of these raises NameError if its code path is reached:

- nodeapply: run_automation accumulated into an exitcode that only existed
  in run(), so any automation error crashed instead of being reported.  It
  now keeps and returns its own, tracked separately from the exit code of
  the ssh commands: the early exit after the spawn loop tests that one,
  and folding automation failures into it would exit with children already
  running and their pipes abandoned.  Both are reported at the real exits.
- nodeconsole: redraw() reads firstnodename, which was local to
  do_screenshot(); promote it to a module global like the other drawing
  state.
- nodedeploy: the redeploy path appended to a lockednodes list that did not
  exist yet.  The block that follows re-reads the same lock state and acts
  on it, so drop the dead duplicate.
- samples/nodeattrib_from_switch.py, misc/filterpasswd: missing import sys.
- xcc3: fixuuid was never imported.  xcc imports xcc3, so take a local copy
  the way the smm handler does instead of creating an import cycle.
- httpapi: the async session call still passed the WSGI-era env and an
  extra argument to handle_async(), which has taken only querydict since
  the aiohttp port.  Calling it correctly exposed that handle_async()
  registers an AsyncSession before raising on the discontinued long poll
  path, so every request to it would leak a session that is never reaped.
  It now only creates one when there is a websocket handler to yield it to.
- messages: the InputFirmwareUpdate.filename property checked
  self.filebynode[node] with no node in scope.  __init__ already validates
  every expanded path and nodefile() rechecks per node, so drop the checks.
- pam: drop the python2 branches referencing unicode and raw_input.  The
  server has been python3 only since the asyncio port.
- cooltera: the sensor-name listing referenced a nonexistent sensors dict.
  The available sensors depend on the model, which is only known after
  reading the device, so list them from the same status data the readings
  use.
- deltapdu, eatonpdu, geist: the not-implemented response in update() used
  node outside the loop, unlike retrieve() in the same files and unlike
  raritan/enlogic.
- confluentdbgcli: stray self. on a module-level socket connect.
2026-08-10 05:32:00 +02:00
Jarrod Johnson e1839b6c6e Adopt nodes with proxy environment variables set 2026-08-06 15:34:36 -04:00
Jarrod Johnson 164a168694 Add fallback to mac table
If LLDP is uncooperative, maybe the mac was learned.

If no mac apparently learned, then we ping_everywhere in hopes of soliciting traffic, and then rescan the switches.

Then get all mac addresses, try to determine zone from generated mac, and print on success.
2026-07-15 08:24:33 -04:00
Markus Hilger ab6eeb3ced Merge branch 'master' into ruff 2026-07-14 05:28:53 +02:00
Markus Hilger 2af402b13c ruff auto fixes
Apply ruff's safe autofixes.
The changes are mechanical and behaviour-preserving. Issues fixed:

- F401: remove unused imports.
- F841: drop unused local variables and assignments, including discarded
  await/return values, unused "except ... as e" bindings, and unused
  "with ... as name" targets.
- F541: remove the f prefix from f-strings that contain no placeholders.
- E711: compare against None with "is"/"is not" instead of "=="/"!=".
- E712: test truthiness directly instead of comparing to True.
- E713: use "x not in y" instead of "not x in y".
- E714: use "is not" instead of "not ... is".
- E731: convert lambdas bound to a name into def statements.
- W291/W293: trim trailing whitespace on touched lines.
2026-07-14 05:03:58 +02:00
Jarrod Johnson c208162839 Add a sample to get ip addresses from a switch port 2026-07-13 13:19:32 -04:00
Jarrod Johnson 33c67db3c4 Further mitigate potential XML misbehavior
Since it turns out we already incurred lxml dependency, use lxml etree instead of xml and mitigate risky xml features beyond blocking the word '!entity'
2026-07-01 08:28:25 -04:00
Jarrod Johnson fc1a16e77f Fix prepfish for XCC3
XCC3 does not do SSDP over the USB host interface.

Workaround by assuming a 'mac - 1' could work.
2026-06-15 10:23:26 -04:00
Markus Hilger 7d7f001826 Handle hostname-prefixed md device names and clear stale superblocks
Newer mdadm versions may load arrays under names like
`/dev/md/<hostname>:raid` after reboot instead of `/dev/md/raid`. Detect both
naming schemes when waiting for the array device and use the resolved
path consistently when determining the underlying md device name.

Also clear existing md superblocks before wiping signatures to avoid
stale RAID metadata interfering with array creation or assembly.
2026-05-22 02:00:41 +02:00
Markus Hilger 94eee92d36 Fix software RAID creation with newer mdadm versions
Recent mdadm versions introduced an interactive prompt when creating RAID arrays
without an explicit bitmap configuration:

  "To optimize recovery speed, it is recommended to enable write-intent bitmap,
   do you want to enable it now? [y/N]?"

This behavior was introduced by upstream change:
https://github.com/md-raid-utilities/mdadm/commit/e97c4e18c847803016aa60066cb6e57c528d83a6

In non-interactive environments such as Anaconda, this prompt blocks installation
and causes RAID creation to hang.

Fix this by explicitly enabling the internal bitmap when creating RAID arrays.
2026-05-21 23:44:53 +02:00
Jarrod Johnson 7787a405bc Merge pull request #210 from VersatusHPC/remove-eventlet
Comment fixup and attempted removal of eventlet workarounds that shouldn't be needed
2026-05-20 15:43:06 -04:00
Jarrod Johnson 1754636c3f Add sample material for nodeconsole automation for MOK manipulation 2026-05-14 17:26:39 -04:00
Vinícius Ferrão 7315200133 Replace pyghmi.util.webclient with aiohmi.util.webclient 2026-05-06 19:48:04 -03:00
Vinícius Ferrão a69d828e69 Remove eventlet dependency, migrate to asyncio/concurrent.futures
Replace eventlet.greenpool with concurrent.futures.ThreadPoolExecutor
in the BMC discovery script, using as_completed() for proper exception
propagation and main-thread result aggregation to avoid race conditions.

Remove dead eventlet socket compatibility code (.fd attribute checks)
from the IPMI session layer, and clean up stale eventlet references
in comments across the codebase.

Closes: xcat2/confluent#197
2026-05-02 22:56:39 -03:00
Jarrod Johnson bc5f9cf1e8 Fix mistakes in the node apoption samples 2026-04-20 09:45:44 -04:00
Jarrod Johnson 69beaad3c9 Induce more versions of openssh to do the proper thing 2026-02-23 15:07:19 -05:00
Jarrod Johnson 74dda48513 Provide helper script for setting up nokia switches 2026-02-23 10:15:55 -05:00
Jarrod Johnson 4f75d4942b Modify adoption process:
Restore useinsecureprotocols if set directly on node

Switch from pxe-style to identity-file based node api token for hardened node authentication
2025-11-20 16:05:22 -05:00
Jarrod Johnson 4d2f36917c Restore useinsecureprotocols after adopt 2025-11-20 15:49:51 -05:00
Jarrod Johnson ac8179b867 Amend swraid example script 2025-08-26 09:49:28 -04:00
Jarrod Johnson 13d9fe2712 Revert useinsecureprotocols to any group value after adoption 2025-07-02 09:55:24 -04:00
Jarrod Johnson 250de6133d Stop trying to save a fingerprint that didn't exist 2025-05-27 15:46:29 -04:00
Jarrod Johnson 9cc3c96f6a Fetch fingerprint before credentials
Some implementations choose to close the certificate command after
granting user/password. Make sure we get the certificate first.
2025-04-08 10:40:07 -04:00
Jarrod Johnson 48921c4ef0 Quick scanner to do ssdp scan 2025-03-31 15:12:29 -04:00
Jarrod Johnson cea87d012c Fix missing import from prepfish example. 2025-03-04 10:51:02 -05:00
Jarrod Johnson 0d4da78f05 Add certificate handling to prepfish.py 2025-03-03 10:51:10 -05:00
Jarrod Johnson f62c0db678 Remove ssh_config directive not supported by EL7wq 2025-02-25 15:29:22 -05:00
Jarrod Johnson 67bacc9934 Add sample script for bringing up a host interface 2025-02-21 15:25:41 -05:00
Jarrod Johnson 24f0ff5221 Add scripts to adopt a node to confluent SSH 2025-01-21 16:48:42 -05:00
Jarrod Johnson 523d5920bc Add a sample script for grabbing XCC screenshots 2024-11-08 12:10:15 -05:00
Jarrod Johnson ed2a8b6f9d Provide an example to name constrain a CA
It's imperfect, and abetter procedure should be written up
for the more security conscious.
2024-09-23 10:45:31 -04:00
Jarrod Johnson 34804b2d5f Provide components for cert management with modern XCC
Refresh getcsr and installcert to handle latest firmware.

Also add ability to have pre-existing CSR, and trust the SAN on the way through.

If this becomes more properly a feature, then would likely impose a SAN
on certs, similar to the SSH principals, rather than deferring to the CSR
to get it right.
2024-04-01 12:13:21 -04:00
Jarrod Johnson 2d906e1886 Fix handling of pre-existing array 2023-10-11 10:15:24 -04:00
Jarrod Johnson 578bd9702a Sample script to install a cert into an XCC 2023-03-24 15:56:26 -04:00
Jarrod Johnson ca5f19a4f1 Sample script for getting a CSR from an XCC 2023-03-24 15:46:21 -04:00
Jarrod Johnson 52c3e9d515 Do not care about port, let kernel decide 2023-03-13 11:19:11 -04:00
Jarrod Johnson 50a4ee2c6d Have a quick sample script to get LLA of USB nic peer 2023-03-13 11:15:31 -04:00
Jarrod Johnson dce80de9d5 Correct syntax error in sample script 2022-11-30 11:09:57 -05:00
Jarrod Johnson 25c66e163c Some notes on TPM recovery 2022-09-21 10:50:05 -04:00
Jarrod Johnson a0037a305c Add confluent_selfcheck to server package 2022-09-02 09:44:13 -04:00
Jarrod Johnson d1d15f29c1 Add facility to fix confluent uuid problem 2022-09-01 13:26:25 -04:00
Jarrod Johnson 20992b2d17 Add check for actual file download 2022-09-01 13:21:39 -04:00
Jarrod Johnson 67f0c8a81b Add IPv6 and insecure boot checking 2022-09-01 13:17:17 -04:00
Jarrod Johnson 28331adced Add TFTP and ssh key checks to checkconfluent 2022-08-31 17:30:41 -04:00
Jarrod Johnson 99a5c454ba Begin work on a sanity checker
Check various facets that are frequently not quite right, making
recommendations on how to correct.
2022-08-30 16:59:40 -04:00
Jarrod Johnson 078e755ec7 Actually feed preseed into config
It must be done to the live cdebconf state *and* preseed.cfg,
since one is referenced immediately and then discarded when
preseed read in.
2022-08-05 16:05:26 -04:00
Jarrod Johnson e3ed54ebf3 Advance the bootstrap of debian installation concept 2022-08-05 14:05:27 -04:00
Jarrod Johnson 9cac0c1705 Amendments to confluent initialization 2022-08-04 16:51:33 -04:00