Skip to content

Commit 1010f17

Browse files
author
Thomas Labarussias
committed
fix panic if connection is lost
2 parents 1cd7154 + 5d26e39 commit 1010f17

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
lines changed

LICENSE

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
MIT License
2-
3-
Copyright (c) 2018 Thomas Labarussias
4-
5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
11-
12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
1+
MIT License
2+
3+
Copyright (c) 2019 Thomas Labarussias
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ Install `session-manager-plugin` : https://docs.aws.amazon.com/systems-manager/l
1515
## Usage
1616

1717
```bash
18-
Usage of sshm:
19-
-profile string
20-
Profile from ~/.aws/config (if empty, a list of your profiles is displayed)
21-
-region string
22-
Region (default "eu-west-1")
18+
Usage of ./sshm:
19+
-i string
20+
Instance-ID for direct connection
21+
-p string
22+
Profile from ~/.aws/config
23+
-r string
24+
Region (only to create session), default is eu-west-1 (default "eu-west-1")
2325
```
2426
You can select your instance by ←, ↑, → ↓ and filter by *Tag:Name*, *InstanceId*, *Hostname*, *PrivateIp*, *PublicIp*, etc. **Enter** key to validate.
2527

main.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,12 @@ func listManagedInstances(sess *session.Session) []instance {
188188
for _, i := range info.InstanceInformationList {
189189
var e instance
190190
e.InstanceID = *i.InstanceId
191-
e.ComputerName = *i.ComputerName
192-
e.PrivateIPAddress = *i.IPAddress
193-
e.PlatformType = *i.PlatformType
194-
e.PlatformName = *i.PlatformName + " " + *i.PlatformVersion
195-
if *i.PingStatus != "Online" {
196-
e.AgentState = "Offline"
197-
} else {
198-
e.AgentState = *i.PingStatus
191+
e.AgentState = *i.PingStatus
192+
if *i.PingStatus == "Online" {
193+
e.ComputerName = *i.ComputerName
194+
e.PrivateIPAddress = *i.IPAddress
195+
e.PlatformType = *i.PlatformType
196+
e.PlatformName = *i.PlatformName + " " + *i.PlatformVersion
199197
}
200198
for _, j := range allInstances {
201199
if *i.InstanceId == j.InstanceID {

0 commit comments

Comments
 (0)