Python 调用cobbler API 学习笔记
来源:互联网 发布:中电四公司怎么样 知乎 编辑:程序博客网 时间:2024/06/05 08:00
1
2
import
xmlrpclib
server
=
xmlrpclib.Server(
"http://cobbler-server.example.org/cobbler_api"
)
1
token
=
server.login(
"username"
,
"password"
)
1
2
3
4
5
6
7
8
#!/usr/bin/python
import
xmlrpclib
server
=
xmlrpclib.Server(
"http://127.0.0.1/cobbler_api"
)
print
server.get_distros()
print
server.get_profiles()
print
server.get_systems()
print
server.get_images()
print
server.get_repos()
1
2
3
4
5
6
7
8
import
xmlrpclib
remote
=
xmlrpclib.Server(http:
/
/
127.0
.
0.1
/
cobbler_api)
token
=
remote.login(
"username"
,
"password"
)
distro_id
=
remote.new_distro(token)
remote.modify_distro(distro_id,
'name'
,
'example-distro'
,token)
remote.modify_distro(distro_id,
'kernel'
,
'/opt/stuff/vmlinuz'
,token)
remote.modify_distro(distro_id,
'initrd'
,
'/opt/stuff/initrd.img'
,token)
remote.save_distro(distro_id,token)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
remote
=
xmlrpclib.Server(
"http://127.0.0.1/cobbler_api"
)
token
=
remote.login(SATELLITE_USER,SATELLITE_PASSWORD)
system_id
=
remote.new_system(token)
remote.modify_system(system_id,
"name"
,
"hostname"
,token)
remote.modify_system(system_id,
"hostname"
,
"hostname.example.com"
,token)
remote.modify_system(system_id,
'modify_interface'
, {
"macaddress-eth0"
:
"01:02:03:04:05:06"
,
"ipaddress-eth0"
:
"192.168.0.1"
,
"dnsname-eth0"
:
"hostname.example.com"
,
}, token)
remote.modify_system(system_id,
"profile"
,
"rhel6-x86_64"
,token)
remote.modify_system(system_id,
"kernel_options"
,
"foo=bar some=thing"
, token)
remote.modify_system(system_id,
"ks_meta"
,
"foo=bar some=thing"
, token)
remote.save_system(system_id, token)
remote.sync(token)
1
remote.remove_profile(
"name-of-profile"
,token)
1
remote.read_or_write_kickstart_template(
"/var/lib/cobbler/foo.ks"
,
False
,new_contents_as_a_string,token)
阅读全文
0 0
- Python 调用cobbler API 学习笔记
- python学习笔记(三) Google map API调用
- 【Python学习笔记】调用函数
- Python 调用百度API
- python百度api调用
- Python学习笔记 - function调用和定义
- jython学习笔记(一)-----Java调用python
- facebook API 调用笔记
- cobbler
- Java学习笔记 Java调用Win32 API控制鼠标活动范围
- Zabbix学习笔记(五)---调用API接口实例
- Zabbix学习笔记(五)---调用API接口实例
- Zookeeper学习笔记(二)通过Java API调用Zookeeper
- [学习笔记]如何调用百度天气api,学习自百度api
- js调用API学习
- Python Socket API 笔记
- Python调用微博API
- python调用新浪API爬虫
- javascript正则表达式简单实用实例
- php中的‘锁’
- cdc管理发布的数据
- bzoj 4300: 绝世好题
- 利用css实现斜线方法
- Python 调用cobbler API 学习笔记
- Redis客户端管理工具的安装及使用
- 第二行代码第五章笔记
- std::istream&初始化的问题
- SDUT-1187 简单编码
- Axios的配置 此处输入图片的描述 既然尤大推荐的应该有过人之处,好吧于是在新的项目上开始使用Axios,开启这段学习(踩坑)的历程。 安装 1 npm install axios 使用 Axio
- Nuttx在Atmel SAMV71 Xplained上的配置
- 严重: Compilation error 解决方案
- jdbcTemplate实现crud操作(添加、删除、更改操作)