Skip to content

Commit

Permalink
fix panic if connection is lost
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Labarussias committed Nov 25, 2019
2 parents 1cd7154 + 5d26e39 commit 1010f17
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 34 deletions.
42 changes: 21 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
MIT License
Copyright (c) 2018 Thomas Labarussias
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License

Copyright (c) 2019 Thomas Labarussias

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ Install `session-manager-plugin` : https://docs.aws.amazon.com/systems-manager/l
## Usage

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

Expand Down
14 changes: 6 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,12 @@ func listManagedInstances(sess *session.Session) []instance {
for _, i := range info.InstanceInformationList {
var e instance
e.InstanceID = *i.InstanceId
e.ComputerName = *i.ComputerName
e.PrivateIPAddress = *i.IPAddress
e.PlatformType = *i.PlatformType
e.PlatformName = *i.PlatformName + " " + *i.PlatformVersion
if *i.PingStatus != "Online" {
e.AgentState = "Offline"
} else {
e.AgentState = *i.PingStatus
e.AgentState = *i.PingStatus
if *i.PingStatus == "Online" {
e.ComputerName = *i.ComputerName
e.PrivateIPAddress = *i.IPAddress
e.PlatformType = *i.PlatformType
e.PlatformName = *i.PlatformName + " " + *i.PlatformVersion
}
for _, j := range allInstances {
if *i.InstanceId == j.InstanceID {
Expand Down

0 comments on commit 1010f17

Please sign in to comment.