Example #1
0
// PutFile copies one or more local files to the remote host, using scp. localfiles can contain wildcards, and remotefile can be either a directory or a file.
// Args: {'User': '******', 'Host': 'REMOTESERVER', 'LocalFile': 'FILENAME', 'RemoteFile': 'FILENAME'}
// Optional Args: {'Password': '******', 'KeyFiles': 'IDRSA', 'DisplayOutput': true, 'AbortOnError': true}
func (p *Provisioning) PutFile(r *http.Request, args *Args, result *Result) error {
	checkFile(r, args, result)
	i := provisioning.Provisioning(args)
	*result = i.PutFile(args.LocalFile, args.RemoteFile)
	log.Printf("Request: %s, Method: PutFile, Args: %s, Result: %s", *r, *args, *result)
	return nil
}
Example #2
0
// Exec takes a command to be executed from API on the remote server.
// Args: {'User': '******', 'Host': 'REMOTESERVER', 'CmdLine': 'CMD'}
// Optional Args: {'AptCache': true, 'UseSudo': true, 'Password': '******', 'KeyFiles': 'IDRSA', 'DisplayOutput': true, 'AbortOnError': true}
func (p *Provisioning) Exec(r *http.Request, args *Args, result *Result) error {
	cmd := provisioning.Cmd{AptCache: args.AptCache, UseSudo: args.UseSudo, CmdLine: args.CmdLine}
	i := provisioning.Provisioning(args)
	*result, _ = i.Execute(cmd)
	log.Printf("Request: %s, Method: Exec, Args: %s, Result: %s", *r, *args, *result)
	return nil
}
Example #3
0
// GetFile copies the file from the remote host to the local FastForward server, using scp. Wildcards are not currently supported.
func (p *Provisioning) GetFile(r *http.Request, args *Args, result *Result) error {
	if args.RemoteFile == "" || args.LocalFile == "" {
		*result = "RemoteFile or LocalFile are needed."
		log.Printf("Request: %s, Error: %s", *r, *result)
	}
	i := provisioning.Provisioning(args)
	*result = i.GetFile(args.RemoteFile, args.LocalFile)
	log.Printf("Request: %s, Method: GetFile, Args: %s, Result: %s", *r, *args, *result)
	return nil
}
Example #4
0
// Self executes a command on the FastForward API server.
// Args: {'CmdLine': 'CMD'}
func (p *Provisioning) Self(r *http.Request, args *Args, result *Result) error {
	i := provisioning.Provisioning(args)
	*result, _ = i.Self(args.Cmd)
	log.Printf("Request: %s, Method: Self, Args: %s, Result: %s", *r, *args, *result)
	return nil
}
Example #5
0
// PutString generates a new file on the remote host containing data. The file is created with mode 0644.
// Args: {'User': '******', 'Host': 'REMOTESERVER', 'Data': 'STRING', 'RemoteFile': 'FILENAME'}
// Optional Args: {'Password': '******', 'KeyFiles': 'IDRSA', 'DisplayOutput': true, 'AbortOnError': true}
func (p *Provisioning) PutString(r *http.Request, args *Args, result *Result) error {
	i := provisioning.Provisioning(args)
	*result = i.PutString(args.Data, args.RemoteFile)
	log.Printf("Request: %s, Method: PutString, Args: %s, Result: %s", *r, *args, *result)
	return nil
}
Example #6
0
// PutFile copies one or more local files to the remote host, using scp. localfiles can contain wildcards, and remotefile can be either a directory or a file.
func (p *Provisioning) PutFile(r *http.Request, args *Args, result *Result) error {
	checkFile(r, args, result)
	i := provisioning.Provisioning(args)
	*result = i.PutFile(args.LocalFile, args.RemoteFile)
	return nil
}