@@ -0,0 +1,1737 @@
+from django.conf import settings%0Afrom pepper import Pepper%0A%0A%0Aclass SaltApi(object):%0A    def __init__(self):%0A        self.api = Pepper(settings.OSR_SALT_REST_API_URL)%0A%0A    def connect(self):%0A        self.api.login(settings.OSR_SALT_REST_API_USERNAME,%0A                       settings.OSR_SALT_REST_API_PASSWORD, 'pam')%0A%0A    def discovery(self, args):%0A        response = self.api.low(%5B%7B'client': 'local', 'tgt': '*', 'fun': 'state.sls',%0A                                  'arg': %5B'staging.discovery', 'concurrent=True',%0A                                          'pillar=%7B%22IP_Address%22:%22%25s%22%7D' %25 args.ip%5D%7D%5D)%0A        return response%0A%0A    def start_task(self, args):%0A        response = self.api.low(%5B%7B'client': 'local_async', 'tgt': '*', 'fun': 'state.sls',%0A                                  'arg': %5B'staging', 'concurrent=True', 'pillar=%7B%22SN%22:%22%25s%22%7D' %25 args.sn%5D%7D%5D)%0A%0A        # response format: %7Bu'return': %5B%7Bu'jid': u'20160718141822884336', u'minions': %5Bu'srv01'%5D%7D%5D%7D%0A        return response%0A%0A    def event(self, args):%0A        # creates event: salt/netapi/hook/osr/stagingtask/FCZ0000012Z9/rebooted%0A        response = self.api.low(%7B'sn': args.sn, 'name': args.name%7D,%0A                                path='/hook/osr/stagingtask/%25s/%25s' %25 (args.sn, args.name))%0A        return response%0A%0A    def show_low_sls(self):%0A        response = self.api.low(%5B%7B'client': 'local', 'tgt': '*', 'fun': 'state.show_low_sls',%0A                                  'arg': %5Bsettings.OSR_SALT_STAGINGTASK_STATENAME, 'concurrent=True'%5D%7D%5D)%0A        return response%0A%0A    def abort_task(self, args):%0A        response = self.api.low(%5B%7B'client': 'local_async', 'tgt': '*', 'fun': 'saltutil.kill_job',%0A                                  'arg': %5Bargs.job_id%5D%7D%5D)%0A        return response

add salt_api_wrapper.py from osr project