OVN实验三:OVN连接外部网络
参考
topo
outside network
|
|
|
+----------------+------------------------------+
| eth1 |
| |
| sw outside |
| |
| ...
控制python函数运行时间
yield
#!/usr/bin/python
# -*- coding: UTF-8 -*-
def fab(max):
n, a, b = 0, 0, 1
while n < max:
yield b # 使用 yield
# print b
a, b = b, a + b
n = n + 1
for n in fab(5):
print n
简单地讲,yield 的作用就是把一个函数变成一个 generator,带有 yield 的函数不再是一个普通函数,Python 解释器会将其视为一个 generator,
调用 fab(5) 不会执行 fab 函数,...
Install Scrapy
Install Scrapy
#!/bin/bash
yum install -y python3 || yum install -y platform-python || yum install -y python2
if [ ! -e /usr/bin/python ];then
if [ -e "/usr/bin/python3" ];then
ln -s /usr/bin/python3 /usr/bin/python
elif [ -e "/usr/libexec/platform-python" ];then
ln -s /usr/libexec/platform-p...
Install Apache+PHP+MySql
Installa Apache
#!/bin/bash
yum install -y httpd
export username=liliang
export groupname=liliang
# add apache user,group
groupadd liliang
useradd liliang -g liliang
sed -i "s/User apache/User ${username}/" /etc/httpd/conf/httpd.conf
sed -i "s/User apache/User ${groupname}/" /etc/httpd/conf/httpd.conf
echo ">>>start copy web files"...
Gitlab API
install
pip install python-gitlab
Documentation
API
# 通过UMB里面的stream找到project:
"stream": "rhel8"
# 创建gitlab对象
gl=gitlab.Gitlab('https://gitlab.com/', private_token='dsfd')
gl.auth()
# 创建工程对象
project = gl.projects.get(project_id)
通过UMB得到mr_id
# 得到merge request对象
mr = project.mergerequests.get(mr_id)
# 获取mr的changes
changes = mr.chan...
Bugzilla API
install
pip install python-bugzilla
github
API
# api address
BZ = 'https://bugzilla.xxx.com'
BZ_API = 'https://bugzilla.xxx.com/xmlrpc.cgi'
# create bugzilla
bzapi = bugzilla.Bugzilla(BZ_API,user=user,password=pwd)
#bzapi.login(user,pwd)
# query bug
query = bzapi.build_query(bug_id=bugs)
query['include_fields'] = ['id', 'status', 'qa_contac...
Execute Script On Boot
Steps
1, create your srcipt under /usr/local/bin
[root@dhcp-128-17 ~]# cat /usr/local/bin/start_job_scheduler.sh
#!/bin/bash
klogin liali 123456
pgrep watchdog.sh || { cd /var/www/html/job_scheduler; ./watchdog.sh & }
pgrep ci-manager.sh || { cd /var/www/html/job_scheduler/ci; ./ci-manager.sh &}
2, call your script in /etc/rc.d/rc.loca...
共计 109 篇文章,14 页。