チュートリアルあるの?
Salt in 60 seconds
公式チュートリアル
Manage the cloud with Terraform, Salt, Consul and DigitalOcean
Salt Notes
Ansible、Puppet、Chefなどとどう違うの
Amon - SaltStack - Review and how it fares against Ansible and Puppet?
python 2なの?3なの?
2です。
そのうち3になるかも。
参考: Python 2.7.x と 3.x の決定的な違いを例とともに | プログラミング | POSTD
pythonって*env的なのあるの?
pyenvがある。
参考: http://qiita.com/nyango/items/f227c259485fbd3c7c9c
saltモジュールのpythonソースにjavadocみたいな型指定のコメントかかれてるけど・・・
PyCharmのtype hintingらしい?
参考: http://qiita.com/methane/items/e95c578c3d8fc5f1f62e
test-kitchen使えないの?
kitchen-saltで使える
Test Kitchen style testing for Salt
saltのテストはPythonつながりでtestinfraでやる、って人もいるかもしれません。
そういう人はbusser-testinfraを使いましょう
https://github.com/jcftang-r7/busser-testinfra
https://github.com/test-kitchen/busser/issues/28
pythonわからん
以下の様なパターンさえ覚えておけば、あとはpythonで困ることは無い気がする。(salt自体の改造とかしなければ)
# Simulating a 'local static' variable in python
# http://stackoverflow.com/a/460811
class Bar(object):
def __init__(self):
self._cache = {}
def __call__(self, a):
if a not in self._cache:
self._cache[a] = self.evaluate(a)
return self._cache[a]
def evaluate(self, a):
return 'foo'
_bar = Bar()
def bar():
return _bar(1)
class propertycache(object):
def __init__(self, func):
self.func = func
self.name = func.__name__
def __get__(self, obj, type=None):
result = self.func(obj)
self.cachevalue(obj, result)
return result
def cachevalue(self, obj, value):
setattr(obj, self.name, value)
# $ salt-run myrunner.baz
# 'myrunner.baz' is not available.
@propertycache
def baz():
return 'baz'
SSH経由で実行できる?
salt-ssh