FastHandle is fast operation tools for infrastructure configurations and tests.
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
preparation:fhhome:test.py.html [2017/12/04 00:34] kurihara |
preparation:fhhome:test.py.html [2019/02/13 00:18] (current) kurihara |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ~~NOTOC~~ | ||
[[: | [[: | ||
+ | ====== $FHHOME/ | ||
- | ====== fabfile/ | + | \\ |
+ | {{INLINETOC}} | ||
+ | \\ | ||
Line 12: | Line 14: | ||
$ fab local_hostname | $ fab local_hostname | ||
- | $ fab -l |grep test. | + | $ fab -l |grep test. # check options |
- | $ echo xx.xx.xx.xx | fab auth.test test.hostname | + | |
+ | $ echo xx.xx.xx.xx | fab test.hostname | ||
+ | $ fhghost.sh " | ||
</ | </ | ||
Line 20: | Line 24: | ||
<sxh bash toolbar: | <sxh bash toolbar: | ||
- | import sys | + | import sys, os |
from fabric.api import * | from fabric.api import * | ||
from fabric.contrib import files | from fabric.contrib import files | ||
+ | from datetime import datetime | ||
+ | FHLINUX=os.environ[" | ||
+ | |||
+ | # test.local_hostname | ||
@task | @task | ||
def local_hostname(): | def local_hostname(): | ||
local(' | local(' | ||
+ | # test.hostname | ||
@task | @task | ||
def hostname(): | def hostname(): | ||
run(' | run(' | ||
+ | |||
+ | # test.sudo | ||
@task | @task | ||
- | def cat_etc_shadow(): | + | def sudo(): |
+ | """ | ||
sudo(' | sudo(' | ||
+ | |||
+ | |||
+ | # test.arg1: | ||
+ | @task | ||
+ | def arg1(cmd): | ||
+ | """ | ||
+ | run(' | ||
+ | |||
+ | |||
+ | # test.arg2: | ||
+ | @task | ||
+ | def arg2(cmd1, cmd2): | ||
+ | """ | ||
+ | run(' | ||
+ | run(' | ||
+ | run(' | ||
+ | |||
+ | |||
+ | # test.put | ||
+ | @task | ||
+ | def put(): | ||
+ | date = datetime.now().strftime(' | ||
+ | local(' | ||
+ | put('/ | ||
+ | run(' | ||
+ | run(' | ||
+ | |||
+ | # test.get | ||
+ | @task | ||
+ | def get(): | ||
+ | date = datetime.now().strftime(' | ||
+ | run(' | ||
+ | get('/ | ||
+ | local(' | ||
+ | local(' | ||
</ | </ |
My Sites
SNS
Copyright (c) 2025 FastHandle - IT Operations Examples All Rights Reserved.