Skip to content

Instantly share code, notes, and snippets.

David Moreau Simard dmsimard

Block or report user

Report or block dmsimard

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dmsimard
dmsimard / test.py
Created Sep 9, 2019
http client test
View test.py
#!/usr/bin/env python3
import json
# Import the client
from ara.clients.http import AraHttpClient
# Instanciate the HTTP client with an endpoint where an API server is listening
client = AraHttpClient(endpoint="https://api.demo.recordsansible.org")
print(json.dumps(client.get("/api/v1/playbooks")))
View reauth.py
import json
import re
from urllib import parse as urlparse
import requests
def _image_tag_from_url(image_url):
if '@' in image_url.path:
@dmsimard
dmsimard / test.py
Created Jun 5, 2019
ara with ansible-runner
View test.py
#!/usr/bin/env python3
# Proof of concept ara with ansible-runner
# Requires https://github.com/ansible/ansible-runner/issues/219#issuecomment-496191227
import ansible_runner
import os
from ara.setup import callback_plugins
PLAYBOOK = """
- name: Test for ansible-runner
View ansible-tests-with-ara.patch
0001-run-tests-with-ara.patch
[root@bastion ansible]# cat 0001-run-tests-with-ara.patch
From af24cfe08bc33a2a63fd2ccc6736f35fd22cdc59 Mon Sep 17 00:00:00 2001
From: root <root@bastion.novalocal>
Date: Fri, 31 May 2019 12:39:49 +0000
Subject: [PATCH] run tests with ara
---
test/integration/integration.cfg | 5 +++++
test/integration/targets/ping/tasks/main.yml | 12 ++++++++++++
@dmsimard
dmsimard / playbook.yml
Last active May 30, 2019
Fix disk layout
View playbook.yml
---
- hosts: all
gather_facts: yes
vars_files:
- devstack_gate_vars.yaml
pre_tasks:
# Note (dmsimard)
# If some swap is already set up, the amount is not 100% accurate
# (ex: 8191MB swap for a 8192MB file)
- name: Configure swap
View github-org-transfer.py
#!/usr/bin/env python
# Copyright Red Hat, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
View human_log.py
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
View ara_playbook_label.yaml
# Would create the label if it doesn't exist
# Description is optional but can be provided
# Appends the label to playbook.labels for state.present
# Removes the label from playbook.labels for state.absent
- name: Label this playbook
ara_playbook_label:
name: "{{ item }}"
state: present
loop:
- pre-run
View ara_api.yaml
- name: Get playbooks
ara_api:
# This doesn't actually need to be specified, the module can pick it up from the callback config
# https://github.com/openstack/ara-plugins/blob/49ce188ab88a6948db651163b9cd7973117fa2b1/ara/plugins/action/ara_record.py#L143-L153
# api_server: https://api.demo.recordsansible.org
action: get
endpoint: /api/v1/playbooks
filter:
status: failed
register: failed_playbooks
You can’t perform that action at this time.