Пример #1
0
 def build_common_extra_vars(self, request):
     return dict(
         api_url=settings.WALDUR_ANSIBLE_COMMON['API_URL'],
         access_token=RefreshTokenMixin().refresh_token(
             self.get_user(request)).key,
         private_key_path=settings.
         WALDUR_ANSIBLE_COMMON['PRIVATE_KEY_PATH'],
         public_key_uuid=settings.WALDUR_ANSIBLE_COMMON['PUBLIC_KEY_UUID'],
     )
Пример #2
0
def get_headers(user):
    """
    It is assumed that localhost is specified in ALLOWED_HOSTS Django setting
    so that internal API requests are allowed.
    """
    token = RefreshTokenMixin().refresh_token(user)
    return dict(content_type='application/json',
                HTTP_AUTHORIZATION='Token %s' % token.key,
                SERVER_NAME='localhost')
Пример #3
0
 def _get_extra_vars(self, job):
     return dict(
         api_url=settings.WALDUR_ANSIBLE_COMMON['API_URL'],
         access_token=RefreshTokenMixin().refresh_token(job.user).key,
         project_uuid=job.service_project_link.project.uuid.hex,
         provider_uuid=job.service_project_link.service.uuid.hex,
         private_key_path=settings.WALDUR_ANSIBLE_COMMON['PRIVATE_KEY_PATH'],
         public_key_uuid=settings.WALDUR_ANSIBLE_COMMON['PUBLIC_KEY_UUID'],
         user_key_uuid=job.ssh_public_key.uuid.hex,
         subnet_uuid=job.subnet.uuid.hex,
         tags=[job.get_tag()],
     )