Exemple #1
0
 def authenticate(self, github_token):
     """
     Retrieve an authentication token
     """
     url = '%s/tokens/' % self.baseurl
     args = urlencode({"github_token": github_token})
     resp = open_url(url, data=args, validate_certs=self._validate_certs, method="POST")
     data = json.loads(to_text(resp.read(), errors='surrogate_or_strict'))
     return data
Exemple #2
0
 def authenticate(self, github_token):
     """
     Retrieve an authentication token
     """
     url = '%s/tokens/' % self.baseurl
     args = urlencode({"github_token": github_token})
     resp = open_url(url, data=args, validate_certs=self._validate_certs, method="POST")
     data = json.load(resp)
     return data
Exemple #3
0
 def authenticate(self, github_token):
     """
     Retrieve an authentication token
     """
     url = '%s/tokens/' % self.baseurl
     args = urlencode({"github_token": github_token})
     resp = open_url(url, data=args, validate_certs=self._validate_certs, method="POST")
     data = json.load(resp)
     return data
Exemple #4
0
 def add_secret(self, source, github_user, github_repo, secret):
     url = "%s/notification_secrets/" % self.baseurl
     args = urlencode({
         "source": source,
         "github_user": github_user,
         "github_repo": github_repo,
         "secret": secret
     })
     data = self.__call_galaxy(url, args=args)
     return data
Exemple #5
0
 def add_secret(self, source, github_user, github_repo, secret):
     url = "%s/notification_secrets/" % self.baseurl
     args = urlencode({
         "source": source,
         "github_user": github_user,
         "github_repo": github_repo,
         "secret": secret
     })
     data = self.__call_galaxy(url, args=args)
     return data
Exemple #6
0
 def create_import_task(self, github_user, github_repo, reference=None):
     """
     Post an import request
     """
     url = '%s/imports/' % self.baseurl
     args = urlencode({
         "github_user": github_user,
         "github_repo": github_repo,
         "github_reference": reference if reference else ""
     })
     data = self.__call_galaxy(url, args=args)
     if data.get('results', None):
         return data['results']
     return data
Exemple #7
0
 def create_import_task(self, github_user, github_repo, reference=None, role_name=None):
     """
     Post an import request
     """
     url = '%s/imports/' % self.baseurl
     args = {
         "github_user": github_user,
         "github_repo": github_repo,
         "github_reference": reference if reference else ""
     }
     if role_name:
         args['alternate_role_name'] = role_name
     elif github_repo.startswith('ansible-role'):
         args['alternate_role_name'] = github_repo[len('ansible-role')+1:]
     data = self.__call_galaxy(url, args=urlencode(args))
     if data.get('results', None):
         return data['results']
     return data
Exemple #8
0
 def create_import_task(self, github_user, github_repo, reference=None, role_name=None):
     """
     Post an import request
     """
     url = '%s/imports/' % self.baseurl
     args = {
         "github_user": github_user,
         "github_repo": github_repo,
         "github_reference": reference if reference else ""
     }
     if role_name:
         args['alternate_role_name'] = role_name
     elif github_repo.startswith('ansible-role'):
         args['alternate_role_name'] = github_repo[len('ansible-role')+1:]
     data = self.__call_galaxy(url, args=urlencode(args))
     if data.get('results', None):
         return data['results']
     return data