def test001_upload_stop_parity_zdb_download(self):
"""
- upload 2M, should succeed.
- Download file, should succeed
- Deleted the downloaded file
- assert md5 checksum is matching
- Stop n zdb, n <= parity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import time | |
import requests | |
import gevent | |
import netaddr | |
from jumpscale import j | |
from zerorobot.service_collection import ServiceNotFoundError | |
from zerorobot.template.base import TemplateBase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jumpscale import j | |
import click, uuid, csv | |
from multiprocessing import Process, Manager | |
logger = j.logger.get('s3_deployment') | |
minio_results_file = 'minio_results_file.csv' | |
#python3 s3.py --robot local --s3_instances 1 --zt_token ****** --zt_nw_id 35c192ce9b3fecb5 --farmer_name tlre --storage_type hdd --storage_size 5 --minio_login minio_login --minio_password ** | |
@click.command() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python3 check_nodes_version.py -f 'kristof-farm' -c 'cb52b076df76c4da6be41999f65f87a047437f30' | |
from jumpscale import j | |
logger = j.logger.get('check_node_commit') | |
import click | |
@click.command() | |
@click.option("-f", "--farm_name", help="farm name to update its zrobot", required=True) | |
@click.option("-c", "--commit_id", help="match with this commit id", default='') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
from subprocess import Popen, PIPE | |
def execute_cmd(cmd): | |
sub = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True) | |
out, err = sub.communicate() | |
return out, err | |
out, err = execute_cmd('ip n') | |
ip_n_data = str(out) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jumpscale import j | |
import click | |
@click.command() | |
@click.option("-f", "--farm_name", help="farm name to update its zrobot", required=True) | |
def main(farm_name): | |
capacity = j.clients.threefold_directory.get(interactive=False) | |
resp = capacity.api.ListCapacity(query_params={'farmer': farm_name})[1] | |
nodes = resp.json() #nodes | |
for node in nodes: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```python | |
s3 = demo.s3['s3_demo_5'] | |
tlog = s3.service.data['data']['tlog'] | |
robot = j.clients.zrobot.robots[tlog['node']] | |
robot._try_god_token() | |
ns = robot.services.get(name=tlog['name']) | |
print(ns.name) | |
zdb = robot.services.get(name=ns.data['data']['zerodb']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jumpscale import j | |
from termcolor import colored | |
from random import randint | |
import click, uuid | |
# Templates | |
zerotier_template = "github.com/threefoldtech/0-templates/zerotier_client/0.0.1" | |
dm_vm_template = "github.com/threefoldtech/0-templates/dm_vm/0.0.1" | |
#python3 dm.py -r local -t ******* -i 35c192ce9ba98299 -n ac1f6b456b98 -im ubuntu -dt hdd -ds 5 -m 2048 -c 1 -s "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjPfKUsaFuaGJsnHvF3k0PbqQTr3GL2pNuddn/xQjsroF35ELJVEovAsd9IlsFWOmDWlL6B+JYFgj8g5IykklHCDfmTu6LcGXjdfAYVp+eXARmgoCJKxVyenSVHu6No9O1e+QKFvMJTiJXdl08fZD1Fd2kRetDRKAijCZ76pmB4/KwVFiJKCVVdsDW/0R+td0gNVJyCQyRTcWEPmBfGMW/JrvRCSHfxlLdqsD3txLOm9pHlQ/LmEwOP3bqEEpQU1jP32JbdAdreuD6BYB+YRp02yyU33gd1QbqIEgftcN+6TuZJOU3j2VRSiUQX8h5SjtWV1UXE15ELlIlhcFJYH6L root@islamtaha-TT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jumpscale import j | |
key = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjPfKUsaFuaGJsnHvF3k0PbqQTr3GL2pNuddn/xQjsroF35ELJVEovAsd9IlsFWOmDWlL6B+JYFgj8g5IykklHCDfmTu6LcGXjdfAYVp+eXARmgoCJKxVyenSVHu6No9O1e+QKFvMJTiJXdl08fZD1Fd2kRetDRKAijCZ76pmB4/KwVFiJKCVVdsDW/0R+td0gNVJyCQyRTcWEPmBfGMW/JrvRCSHfxlLdqsD3txLOm9pHlQ/LmEwOP3bqEEpQU1jP32JbdAdreuD6BYB+YRp02yyU33gd1QbqIEgftcN+6TuZJOU3j2VRSiUQX8h5SjtWV1UXE15ELlIlhcFJYH6L root@islamtaha-TT' | |
node = j.clients.zos.get('e0d55e6af8cd', data={'host':'10.102.132.23'}) | |
# Like vm template | |
data = {'configs': [{'content': key, | |
'name': 'ssh', | |
'path': '/root/.ssh/authorized_keys'}], | |
'cpu': 2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get update | |
apt-get install -y curl python3-dev locales | |
export INSYSTEM=0 | |
export USEGIT=1 | |
curl https://raw.githubusercontent.com/threefoldtech/jumpscaleX/master/install/install.py?$RANDOM > /tmp/install.py;python3 /tmp/install.py |