Skip to content

Conversation

@ZLLentz
Copy link
Member

@ZLLentz ZLLentz commented Dec 11, 2025

Do not merge/tag until team members can access sdfconfig.

Use sdfconfig instead of netconfig to get the "location" and "description" information about servers as we click through the IOC table.

https://jira.slac.stanford.edu/browse/ECS-9486

Netconfig is being deprecated/disabled/removed soon, so we need to switch.

Interesting decisions made:

  • Disable some of the abandoned hard ioc tools altogether. These expect certain information in a certain format from netconfig to be useful, but this data doesn't exist in any format in sdfconfig. Since hard iocs are a relic of a past architecture, I'm opting to disable these features rather than ask the SCS team to support them indefinitely.
  • Fill in the location with some helpful backups if the user doesn't have sdfconfig configured or if the server doesn't exist.
  • The description field doesn't work with sdfconfig right now (the information in not present in foreman)- I'm assuming it will work in the future and be called "description" as it was before. If not, we'll need an edit here.
  • Use a regex instead of string splitting to parse the script output
  • Avoid --legacy switch because the output was different enough to break the old parsing code anyway. (I've also requested a json output which would make the parsing code less silly).

I tested this in the following way:

  • Made sure the location field matched the info from sdfconfig (instead of the info from netconfig, which is slightly different)
  • Renamed my sdfconfig config file as to remove my foreman auth, and made sure that iocmanager still launched and gave my fallback location data ("please configure sdfconfig")
  • Made sure the unit tests pass: I had to fix some test configuration that had stopped working for the start_proc test at some point but was missed because we hadn't set up CI yet and it worked in prod.

@ZLLentz ZLLentz changed the title WIP: sdfconfig MNT: sdfconfig Dec 12, 2025
…re on the path during the test suite. This is how we specify them in prod now but this test was never checked or updated.
@ZLLentz ZLLentz marked this pull request as ready for review December 12, 2025 22:43
@ZLLentz ZLLentz requested review from a team as code owners December 12, 2025 22:43
Copy link
Contributor

@tangkong tangkong left a comment

Choose a reason for hiding this comment

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

The changes here seem good, I don't have access to sdfconfig so my interactive testing is somewhat limited.

iocmanager loads fine for me, with "please configure sdfconfig" all over. I might have put that string in brackets or something to make it stand out, but other than that this looks good.

I'll hold off on the approve until we get verification that the rest of the team can auth with sdfconfig

)


def sdfconfig(host: str, domain: str = "pcdsn") -> dict[str, str]:
Copy link
Contributor

Choose a reason for hiding this comment

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

(not really an issue to be fixed in this PR)

I wonder how much the overhead of calling sdfconfig is. Before we called netconfig and just ingested everything, and while this is certainly more efficient for single hosts I do wonder what happens if we end up needing to query lots of hosts.

Does sdfconfig have an option for looking up information on multiple hosts at once?

Copy link
Member Author

Choose a reason for hiding this comment

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

netconfig was also used one host at a time here. sdfconfig has a search option too but the hosts would need to have some similarity.

The overhead is more than I would like, but for iocmanager at least we do this on a background thread to not pause the app execution.

Parameters
----------
host : str
The hostname
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpicky, but domain is also parameter

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch

or an empty dict if there was no information.
"""
output = {}
pattern = re.compile(r"^(\S.+?):\s+(\S.+)$")
Copy link
Member Author

Choose a reason for hiding this comment

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

After mulling it over, I think it's worth switching this back to simple text parsing instead of regex due to readability concerns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants