7.3 KiB
plugin
import "github.com/Akilan1999/p2p-rendering-computation/plugin"
Index
- func CheckRunPlugin(PluginName string, ID string) error
- func DeletePlugin(pluginname string) error
- func DownloadPlugin(pluginurl string) error
- func RunPluginContainer(PluginName string, ContainerID string) error
- type ExecuteIP
- type Host
- type Plugin
- func RunPlugin(pluginName string, IPAddresses []*ExecuteIP) (*Plugin, error)
- func SearchPlugin(pluginname string) (*Plugin, error)
- func (p *Plugin) AutoSetPorts(containerID string) error
- func (p *Plugin) CopyToTmpPlugin() error
- func (p *Plugin) ExecutePlugin() error
- func (p *Plugin) NumPorts() error
- type Plugins
func CheckRunPlugin
func CheckRunPlugin(PluginName string, ID string) error
CheckRunPlugin Checks if the ID belongs to the group or container calls the plugin function the appropriate amount of times
func DeletePlugin
func DeletePlugin(pluginname string) error
DeletePlugin The following function deletes a plugin based on the plugin name provided.
func DownloadPlugin
func DownloadPlugin(pluginurl string) error
DownloadPlugin This functions downloads package from a git repo.
func RunPluginContainer
func RunPluginContainer(PluginName string, ContainerID string) error
RunPluginContainer Runs ansible plugin based on plugin name and container name which is derived from the tracked containers file We pass in the group ID as a parameter because when we modify the ports taken
type ExecuteIP
ExecuteIP IP Address to execute Ansible instruction
type ExecuteIP struct {
ContainerID string
IPAddress string
SSHPortNo string
Success bool
}
func (*ExecuteIP) ModifyHost
func (e *ExecuteIP) ModifyHost(p *Plugin) error
ModifyHost adds IP address , port no to the config file
func (*ExecuteIP) RunAnsible
func (e *ExecuteIP) RunAnsible(p *Plugin) error
RunAnsible Executes based on credentials on the struct
type Host
Host Struct for ansible host Generated from https://zhwt.github.io/yaml-to-go/
type Host struct {
All struct {
Vars struct {
AnsiblePythonInterpreter string `yaml:"ansible_python_interpreter"`
} `yaml:"vars"`
} `yaml:"all"`
Main struct {
Hosts struct {
Host1 struct {
AnsibleHost string `yaml:"ansible_host"`
AnsiblePort int `yaml:"ansible_port"`
AnsibleUser string `yaml:"ansible_user"`
AnsibleSSHPass string `yaml:"ansible_ssh_pass"`
AnsibleSudoPass string `yaml:"ansible_sudo_pass"`
} `yaml:"host1"`
} `yaml:"hosts"`
} `yaml:"main"`
}
func ReadHost
func ReadHost(filename string) (*Host, error)
ReadHost Reads host file and adds
type Plugin
Plugin Information about the plugins available
type Plugin struct {
FolderName string
PluginDescription string
Execute []*ExecuteIP
NumOfPorts int
// contains filtered or unexported fields
}
func RunPlugin
func RunPlugin(pluginName string, IPAddresses []*ExecuteIP) (*Plugin, error)
RunPlugin Executes plugins based on the plugin name provided
func SearchPlugin
func SearchPlugin(pluginname string) (*Plugin, error)
SearchPlugin Detects plugin information based on the name provided on the parameter
func (*Plugin) AutoSetPorts
func (p *Plugin) AutoSetPorts(containerID string) error
AutoSetPorts Automatically maps free ports to site.yml file
func (*Plugin) CopyToTmpPlugin
func (p *Plugin) CopyToTmpPlugin() error
CopyToTmpPlugin This function would ensure that we create a copy of the plugin in the tmp directory, and it would be executed from there. This due to the reason of automating port allocation when running plugins
func (*Plugin) ExecutePlugin
func (p *Plugin) ExecutePlugin() error
ExecutePlugin Function to execute plugins that are called
func (*Plugin) NumPorts
func (p *Plugin) NumPorts() error
NumPorts Gets the Number the ports the plugin requires
type Plugins
Plugins Array of all plugins detected
type Plugins struct {
PluginsDetected []*Plugin
}
func DetectPlugins
func DetectPlugins() (*Plugins, error)
DetectPlugins Detects all the plugins available
Generated by gomarkdoc