Discussion:
[Fab-user] Remote fabfile
Irving Rabin
2014-09-30 23:52:08 UTC
Permalink
<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>Folks, I am new to Fabric and I have written quite a complicated fabfile.py script. It is used to install a product. The script resides along with a product on a Github. I don&#39;t want to clone the whole product to the local machine, so my question is simple - can I provide a network address of fabfile to fab command, something like this:<br/> <br/> <span style="font-size:14px;"><span style="font-family:courier new,courier,monospace;">&nbsp;&nbsp; &nbsp;fab -H &lt;host-name&gt; -f ***@github.com:&lt;my-repository&gt;/&lt;path&gt;/&lt;filename&gt; task:&lt;parms&gt;</span></span><br/>
<br/>
Pretty much any elegant idea of getting just a single file should suffice. But providing a network path for this file would be probably the best solution.<br/>
<br/>
Thanks,<br/>
Irv Rabin</div></div></body></html>
Jeff Forcier
2014-10-01 19:12:01 UTC
Permalink
There's no way to do this built in (nor do I see it as necessarily
being worth the development effort offhand - feels like a niche use
case and prioritzation is unfortunately a thing), but the first thing
that springs to mind is using shell tools like zsh's temporary-file
support, e.g.:

$ fab -H <target> -f =(curl
https://raw.githubusercontent.com/<user>/<repo>/<ref>/fabfile.py)
task:<params>

Where '=(<command>)' creates a local temporary file containing the
stdout of <command>, then expands into that temporary filename.
Presumably bash 4 and other common shells also offer something like
this.

You could also use Python for this, though it'd be more work - e.g.
have a setup task that performs the download, calls __import__ on the
temp file, then hands the resulting module object to Fabric's CLI
functions.
Post by Irving Rabin
Folks, I am new to Fabric and I have written quite a complicated fabfile.py
script. It is used to install a product. The script resides along with a
product on a Github. I don't want to clone the whole product to the local
machine, so my question is simple - can I provide a network address of
task:<parms>
Pretty much any elegant idea of getting just a single file should suffice.
But providing a network path for this file would be probably the best
solution.
Thanks,
Irv Rabin
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
--
Jeff Forcier
Unix sysadmin; Python/Ruby engineer
http://bitprophet.org
Kevin Horn
2014-10-01 20:12:47 UTC
Permalink
Post by Jeff Forcier
There's no way to do this built in (nor do I see it as necessarily
being worth the development effort offhand - feels like a niche use
case and prioritzation is unfortunately a thing), but the first thing
that springs to mind is using shell tools like zsh's temporary-file
$ fab -H <target> -f =(curl
https://raw.githubusercontent.com/<user>/<repo>/<ref>/fabfile.py)
task:<params>
Where '=(<command>)' creates a local temporary file containing the
stdout of <command>, then expands into that temporary filename.
Presumably bash 4 and other common shells also offer something like
this.
Bash does, though I can't recall offhand how to do it exactly. IIRC it's
pretty similar to zsh, but my memory is notoriously faulty.
Post by Jeff Forcier
You could also use Python for this, though it'd be more work - e.g.
have a setup task that performs the download, calls __import__ on the
temp file, then hands the resulting module object to Fabric's CLI
functions.
You might check out Plumbum: https://pypi.python.org/pypi/plumbum

I think it would be fairly easy to rig something up with it.
Post by Jeff Forcier
Post by Irving Rabin
Folks, I am new to Fabric and I have written quite a complicated
fabfile.py
Post by Irving Rabin
script. It is used to install a product. The script resides along with a
product on a Github. I don't want to clone the whole product to the local
machine, so my question is simple - can I provide a network address of
:<my-repository>/<path>/<filename>
Post by Irving Rabin
task:<parms>
Pretty much any elegant idea of getting just a single file should
suffice.
Post by Irving Rabin
But providing a network path for this file would be probably the best
solution.
Thanks,
Irv Rabin
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
--
Jeff Forcier
Unix sysadmin; Python/Ruby engineer
http://bitprophet.org
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
--
--
Kevin Horn
Loading...