Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
List all machine IP addrs in YAML and JSON output #6424
Merged
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
Jump to file or symbol
Failed to load files and symbols.
| @@ -42,15 +42,33 @@ type MachineStatus struct { | ||
| AgentStatus DetailedStatus `json:"agent-status"` | ||
| InstanceStatus DetailedStatus `json:"instance-status"` | ||
| - DNSName string `json:"dns-name"` | ||
| - InstanceId instance.Id `json:"instance-id"` | ||
| - Series string `json:"series"` | ||
| - Id string `json:"id"` | ||
| - Containers map[string]MachineStatus `json:"containers"` | ||
| - Hardware string `json:"hardware"` | ||
| - Jobs []multiwatcher.MachineJob `json:"jobs"` | ||
| - HasVote bool `json:"has-vote"` | ||
| - WantsVote bool `json:"wants-vote"` | ||
| + DNSName string `json:"dns-name"` | ||
| + | ||
| + // IPAddresses holds the IP addresses bound to this machine. | ||
| + IPAddresses []string `json:"ip-addresses"` | ||
macgreagoir
Contributor
|
||
| + | ||
| + // InstanceId holds the unique identifier for this machine, based on | ||
| + // what is supplied by the provider. | ||
| + InstanceId instance.Id `json:"instance-id"` | ||
| + | ||
| + // Series holds the name of the operating system release installed on | ||
| + // this machine. | ||
| + Series string `json:"series"` | ||
| + | ||
| + // Id is the Juju identifier for this machine in this model. | ||
| + Id string `json:"id"` | ||
| + | ||
| + // Containers holds the MachineStatus of any containers hosted on this | ||
| + // machine. | ||
| + Containers map[string]MachineStatus `json:"containers"` | ||
| + | ||
| + // Hardware holds a string of space-separated key=value pairs of | ||
| + // hardware specification datum. | ||
| + Hardware string `json:"hardware"` | ||
| + | ||
| + Jobs []multiwatcher.MachineJob `json:"jobs"` | ||
| + HasVote bool `json:"has-vote"` | ||
| + WantsVote bool `json:"wants-vote"` | ||
| } | ||
| // ApplicationStatus holds status info about an application. | ||
| @@ -80,7 +98,7 @@ type UnitStatus struct { | ||
| // AgentStatus holds the status for a unit's agent. | ||
| AgentStatus DetailedStatus `json:"agent-status"` | ||
| - // WorkloadStatus holds the status for a unit's workload | ||
| + // WorkloadStatus holds the status for a unit's workload. | ||
| WorkloadStatus DetailedStatus `json:"workload-status"` | ||
| WorkloadVersion string `json:"workload-version"` | ||
| @@ -101,7 +119,7 @@ type RelationStatus struct { | ||
| Endpoints []EndpointStatus `json:"endpoints"` | ||
| } | ||
| -// EndpointStatus holds status info about a single endpoint | ||
| +// EndpointStatus holds status info about a single endpoint. | ||
| type EndpointStatus struct { | ||
| ApplicationName string `json:"application"` | ||
| Name string `json:"name"` | ||
| @@ -127,7 +145,7 @@ type DetailedStatus struct { | ||
| Err error `json:"err,omitempty"` | ||
| } | ||
| -// History holds many DetailedStatus, | ||
| +// History holds many DetailedStatus. | ||
| type History struct { | ||
| Statuses []DetailedStatus `json:"statuses"` | ||
| Error *Error `json:"error,omitempty"` | ||
| @@ -148,7 +166,7 @@ type StatusHistoryRequest struct { | ||
| Tag string `json:"tag"` | ||
| } | ||
| -// StatusHistoryRequests holds a slice of StatusHistoryArgs | ||
| +// StatusHistoryRequests holds a slice of StatusHistoryArgs. | ||
| type StatusHistoryRequests struct { | ||
| Requests []StatusHistoryRequest `json:"requests"` | ||
| } | ||
| @@ -188,7 +206,7 @@ type StatusResults struct { | ||
| Results []StatusResult `json:"results"` | ||
| } | ||
| -// ApplicationStatusResult holds results for an application Full Status | ||
| +// ApplicationStatusResult holds results for an application Full Status. | ||
| type ApplicationStatusResult struct { | ||
| Application StatusResult `json:"application"` | ||
| Units map[string]StatusResult `json:"units"` | ||
Oops, something went wrong.
This loop is in quite similar to what network.FilterUnusableHostPorts() does, unfortunately not for []network.Address.
Nevertheless, please use the same approach here - switch on mAddr.Scope and filter ScopeMachineLocal and ScopeLinkLocal. This will cover the full loopback ranges 127/8 and ::1/128 on both IPv4 and IPv6 addresses, and will also not show the linkewise-unusable link local addresses.