Skip to content

Instantly share code, notes, and snippets.

@stylesen
stylesen / lavacli-job-submit-sequential.sh
Created April 3, 2018 02:28
lavacli job submit after completion of each job
#!/bin/bash
count="0"
while [ "$count" -lt "5" ]
do
echo "Iteration: $count"
job_id=$(lavacli --identity localhost jobs submit /tmp/lxc.yaml)
echo "Submitted job: $job_id"
lavacli --identity localhost jobs wait $job_id
count=$[$count+1]
sudo docker run -v /home/stylesen/fileshare:/fileshare -v /var/run/docker.sock:/var/run/docker.sock -itd -e HOSTNAME='docker-worker-1' -e MASTER='tcp://lava.codehelp.co.uk:5556' -e SOCKET_ADDR='tcp://lava.codehelp.co.uk:5555' -e LOG_LEVEL='DEBUG' -e ENCRYPT=1 -e MASTER_CERT='/fileshare/master.key' -e SLAVE_CERT='/fileshare/docker-worker-1.key_secret' -p 2222:22 --privileged --name ld-2018.2-1 stylesen/lava-dispatcher-debian-stretch:2018.2-1
@stylesen
stylesen / proble-image-guestfs.py
Created December 22, 2017 07:24
Convert a sparse image to ext4 image and use python-guestfs to play with it
#!/usr/bin/env python
import os
import guestfs
import subprocess
image = '/tmp/rpb-console-image-hikey-20171218134627-9.rootfs.img'
ext4_img = 'rpb-console-image-hikey-20171218134627-9.rootfs.img.ext4'
@stylesen
stylesen / install-docker-debian.sh
Last active February 1, 2018 08:50
Install Docker CE in Debian Jessie and above
#!/bin/sh
sudo apt-get -y update
sudo apt-get -y install apt-transport-https ca-certificates curl gnupg2 \
software-properties-common
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable"
$ git diff
diff --git a/lava_dispatcher/protocols/lxc.py b/lava_dispatcher/protocols/lxc.py
index 4c7c118415..5acb2ab37f 100644
--- a/lava_dispatcher/protocols/lxc.py
+++ b/lava_dispatcher/protocols/lxc.py
@@ -127,13 +127,15 @@ class LxcProtocol(Protocol): # pylint: disable=too-many-instance-attributes
logger.exception(msg)
raise JobError("Invalid call to %s %s" % (self.name, exc))
- def _call_handler(self, command):
@stylesen
stylesen / lava_submit_job.py
Created November 2, 2017 09:21
Example LAVA job submission python script.
#!/usr/bin/env python
import sys
import yaml
import xmlrpclib
USERNAME = "stylesen"
TOKEN = "yourtoken"