-
Notifications
You must be signed in to change notification settings - Fork 202
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
libnetwork: add NetworkInfo() for get network information #1460
Conversation
1c77e5f
to
f241567
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.
LGTM
podman info prints the network information as shown below: networkBackendInfo:
backend: cni
dns:
package: podman-plugins-4.5.0-1.fc37.x86_64
path: /usr/libexec/cni/dnsname
package: |-
containernetworking-plugins-1.1.1-8.fc37.x86_64
podman-plugins-4.5.0-1.fc37.x86_64
path: /usr/libexec/cni networkBackendInfo:
backend: netavark
dns:
package: aardvark-dns-1.6.0-1.fc37.x86_64
path: /usr/libexec/podman/aardvark-dns
version: aardvark-dns 1.6.0
package: netavark-1.6.0-2.fc37.x86_64
path: /usr/libexec/podman/netavark
version: netavark 1.6.0 |
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.
mostly looks good just some minor comments
|
||
dnsPath := filepath.Join(path, "dnsname") | ||
dnsPackage := cutil.PackageVersion(dnsPath) | ||
if _, err := os.Stat(dnsPath); err == nil { |
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.
At least for dnsname you can get the version from the binary as well:
$ /usr/libexec/cni/dnsname --version
CNI dnsname plugin
version: 1.3.1
commit: unknown
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.
Add a wrapper function ProgramVersionDnsname()
to get the dnsname information.
AFAICS, dnsname --version returns the information to stdErr.
# /usr/libexec/cni/dnsname --version > /dev/null
CNI dnsname plugin
version: 1.3.1
commit: unknown
# /usr/libexec/cni/dnsname > /dev/null
CNI dnsname plugin
version: 1.3.1
commit: unknown
# /usr/libexec/cni/dnsname --version 2> /dev/null
# /usr/libexec/cni/dnsname 2> /dev/null
podman info prints the network information as shown below: networkBackendInfo:
backend: cni
dns:
package: podman-plugins-4.5.0-1.fc37.x86_64
path: /usr/libexec/cni/dnsname
version: |-
CNI dnsname plugin
version: 1.3.1
commit: unknown
package: |-
containernetworking-plugins-1.1.1-8.fc37.x86_64
podman-plugins-4.5.0-1.fc37.x86_64
path: /usr/libexec/cni networkBackendInfo:
backend: netavark
dns:
package: aardvark-dns-1.6.0-1.fc37.x86_64
path: /usr/libexec/podman/aardvark-dns
version: aardvark-dns 1.6.0
package: netavark-1.6.0-2.fc37.x86_64
path: /usr/libexec/podman/netavark
version: netavark 1.6.0 |
dd7d770
to
6595ffb
Compare
NetworkInfo() return the network binary path, package version, program version and DNS information. Signed-off-by: Toshiki Sonoda <[email protected]>
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.
LGTM
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: flouthoc, Luap99, rhatdan, sstosh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
NetworkInfo()
return the network binary path,package version and program version.
Related to containers/podman#18383