added functionality to trigger ansibles from cli

This commit is contained in:
2021-08-08 00:21:44 +04:00
parent af4b129bee
commit 5ff6702d9c
12 changed files with 354 additions and 17 deletions

View File

@@ -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. ")
}