| Age | Commit message (Collapse) | Author |
|
Previously we have Command, environment, and script types to handle
all functionalities. The name for Command is kind a misleading, because
it contains method to copy files in local or remote and to execute
script in local or remote.
This refactoring break down the types into Awwan, Session, and Script.
Awwan contains cache of sessions and cache of environment files.
Session manage and cache SSH client and list of scripts.
One session have one SSH client, but may contains more than one script.
Script define the content of ".aww" file, line by line.
|
|
This changes introduce new type Awwan that will run the "local" and
"play" command.
This is the first changes to refactoring the code to separate between
script, host, and command to make it reusable and can be run multiple
times.
|
|
|
|
This changes replace the string ${x} or $x in the statements with the
current environment variables values.
For example, statement "mkdir ${HOME}/tmp" will expand the ${HOME} to
the current user home directory.
|
|
Previously, the command to put and get file from remote server depends
on installed scp program on the host computer.
In this changes we add the SFTP client and use it as primary function
to put and get file to/from remote when possible and use the scp as
fallback.
|
|
This update affect SSH client initialization and method to put and get
file on SSH client.
|
|
|
|
|
|
|
|
If the mode is local there is no need to parse and load the SSH config,
since the command to be executed will run on local machine anyway.
|
|
This is to give better readibility on the log output.
|
|
This type is not usable if its exported. So, let unexport them to let
user focus on Command.
|
|
Previously, the base directory is set on current working directory.
This limit the way to execute awwan only from the directory
that contains the .ssh directory.
This changes set the environment BaseDir based on the first .ssh
directory that we found from script path up to the "/". So, user can
execute awwan script from any sub-directories.
|
|
This is to allow the script to reference SSHKey, SSHUser, SSHHost, and
SSHPort variables from environment.
|
|
This is the second commit for refactoring the code. The Environment
will responsible to load the awwan.env files and SSHConfig, everything
else will be handled by Command.
|
|
We are gonna refactor most of the code so it will be more readable and
testable.
|
|
A good library is the one that return an error when something happened,
not immediately stop the program.
I made a mistake and I learn from it.
|
|
In case the owner of file is not active user and it does not have
read permission, the "#get!" command will fail when copying command
from remote to local.
|
|
By knowing this values, user can use it to invoke other SSH related
command, for example to copy file using `scp`
scp -i {{.SSHKey}} src {{.SSHUser}}@{{.SSHHost}}:{{.SSHPort}}/dst
|
|
|
|
Magic word `#require:` will ensure that the next statement will always
executed when its skipped with start number.
For example, given following script with line number
1: #require:
2: echo a
3: echo b
4: #require:
5: echo c
```
executing `awwan local script.aww 3`, will always execute line
number 2 `echo a`, but not line number 5 (because its before line start 3).
|
|
Previously, if command contains quote like,
echo "a b"
the script will run it as ["echo", `"a`, `b"`] which is not what we
will expected and may cause some command failed to run.
This changes fix the parsing of command string by detecting possible
quote.
|
|
* Makefile: make the default task to build the command
|
|
Magic word `#get!` will copy file from remote server, that can be accessed
only by using sudo, to your local file.
Example,
#get! /etc/nginx/ssl/my.crt server.crt
|
|
This will allow piping the actual output of executed command to
stdout or file.
|
|
|
|
Previously we need to define the SSH host, user, port, and private key
file in the environment file.
This change use the SSH config format and automatically match and find
the script directory name with the Host or Match section.
|
|
|
|
Previously, to copy file with root we use,
#put: src /tmp
sudo mv /tmp /desc
The new magic keywords "#put!" will handle the "sudo mv" part, so user
only need to put,
#put! src /desc
Nice!
|
|
This change remove the command mode "bootstrap" and replace default
environment file from "env.ini" to "awwan.env".
|
|
awwan is command line interface to configurate and manage remote system
through SSH connection.
|