added functionality to trigger ansibles from cli
This commit is contained in:
@@ -144,4 +144,22 @@ func ReadTrackContainers(filename string) (*TrackContainers, error) {
|
||||
}
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// GetContainerInformation gets information about container based on
|
||||
// container ID provided
|
||||
func GetContainerInformation(ID string) (*TrackContainer, error) {
|
||||
// Getting the current containers
|
||||
err, CurrentContainers := ViewTrackedContainers()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Iterating through all tracked containers to get the container information
|
||||
// of the ID passed through the function parameter
|
||||
for _, container := range CurrentContainers.TrackcontianerList {
|
||||
if container.Container.ID == ID {
|
||||
return &container, nil
|
||||
}
|
||||
}
|
||||
return nil, errors.New("Container not found. ")
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"TrackContainer": [
|
||||
{
|
||||
"ID": "858912730fb34f3cce38ef6d405e04519e44f50c2a496cd400e75aaa0def3c80",
|
||||
"Container": {
|
||||
"SSHUsername": "master",
|
||||
"SSHPassword": "password",
|
||||
"ID": "858912730fb34f3cce38ef6d405e04519e44f50c2a496cd400e75aaa0def3c80",
|
||||
"TagName": "p2p-ubuntu",
|
||||
"ImagePath": "/home/akilan/Documents/p2p-rendering-computation/server/docker/containers/docker-ubuntu-sshd/",
|
||||
"Ports": {
|
||||
"Port": [
|
||||
{
|
||||
"PortName": "SSH",
|
||||
"InternalPort": 22,
|
||||
"Type": "tcp",
|
||||
"ExternalPort": 44269,
|
||||
"Description": "SSH Port"
|
||||
},
|
||||
{
|
||||
"PortName": "NoVNC",
|
||||
"InternalPort": 5901,
|
||||
"Type": "tcp",
|
||||
"ExternalPort": 40725,
|
||||
"Description": "NoVNC port"
|
||||
},
|
||||
{
|
||||
"PortName": "NoVNC",
|
||||
"InternalPort": 6081,
|
||||
"Type": "tcp",
|
||||
"ExternalPort": 40053,
|
||||
"Description": "NoVNC port"
|
||||
}
|
||||
]
|
||||
},
|
||||
"GPU": "false"
|
||||
},
|
||||
"IpAddress": "0.0.0.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user