-
Notifications
You must be signed in to change notification settings - Fork 198
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
status: Add version into status --json
#3251
Conversation
I wanted to add some code into openshift/machine-config-operator which checked the rpm-ostree version. We can do this today with `rpm-ostree --version` or `rpm -q rpm-ostree`, but the MCO today already reads `rpm-ostree status --json`. It's much more natural to parse JSON for this as opposed to forking the binary again or querying rpm. (The latter in particular would require splitting on the upstream version vs release tag etc.)
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.
Hmm, just forking rpm-ostree --version
again doesn't seem like a big deal. It's in YAML format too, so it's ready to parse and has even more versioning info! :)
Having it in status --json
feels a bit odd IMO, but not strongly against either.
I wrote a whole rationale in the commit message about this - specifically JSON vs YAML, and the fact that we are already parsing the status output. Probably though what we really want here is official Go bindings #2389 |
Right, I get that it's the most convenient thing to do for the MCO. But we should still weigh the different options. For example, I see you've already got something using
👍 |
Yes, but I only wrote all that code because we didn't have the version in status 😄 |
This is *mainly* to validate that openshift/release#24225 worked. But, this code may be useful as a sanity check going forward. See also coreos/rpm-ostree#3251 (I also may try to expose e.g. `ex-container` as a feature flag that we can query instead of version-parsing)
What I mean is wouldn't most of that code be the same though? Since we'd still have to parse a version string. (Again to clarify, I'm OK with this. But I think there's an opportunity to make that MCO code way simpler if we just extend |
Eh, we can revisit this later. |
This is *mainly* to validate that openshift/release#24225 worked. But, this code may be useful as a sanity check going forward. See also coreos/rpm-ostree#3251 (I also may try to expose e.g. `ex-container` as a feature flag that we can query instead of version-parsing)
I wanted to add some code into openshift/machine-config-operator
which checked the rpm-ostree version. We can do this today with
rpm-ostree --version
orrpm -q rpm-ostree
, but the MCO todayalready reads
rpm-ostree status --json
.It's much more natural to parse JSON for this as opposed to forking
the binary again or querying rpm. (The latter in particular would
require splitting on the upstream version vs release tag etc.)