首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

WebSphere CloudBurst Appliance 命令行界面简介-4

WebSphere CloudBurst Appliance 命令行界面简介-4

使用 batch 模式除了交互模式外,另一种调用 CLI 界面的方法就是 batch 模式。batch 模式可以通过 -c-f 参数调用。-c 参数让您能够为调用提供一个命令。例如,假设您需要获得组成云的管理程序的快速列表。实现方法就是发起一个 CLI 会话并使用 -c 参数传递相应的命令。如清单 10 和 11 所示,在发起会话的同时提供了命令,因此不会启动交互式 shell。
清单 10. 为 CLI 提供命令 - 命令
1
2
C:\cloudburst\cloudburst.cli\bin>cloudburst -h mycloudburst.com -u cloudburstUser
    -p password -c "cloudburst.hypervisors"




清单 11. 为 CLI 提供命令 - 输出
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[
  {
    "address": "https://myhypervisor01.com/sdk",
    "certificate": (nested object),
    "certified": "T",
    "cloud": (nested object),
    "created": May 13, 2009 4:25:02 PM,
    "currentmessage": "RM03103",
    "currentmessage_text": "Started (move to maintenance mode to make changes)",

    "currentstatus": "RM01006",
    "currentstatus_text": "Started",
    "desiredstatus": "RM01006",
    "desiredstatus_text": "Started",
    "id": 1,
    "name": "Virtual WAS",
    "networks": (nested object),
    "password": "12422499021750",
    "storage": (nested object),
    "type": "ESX",
    "updated": May 13, 2009 4:25:48 PM,
    "userid": "root"
  }
]




您也可以通过传入多个 -c 参数传递多个命令。在清单 12 所示的命令中,执行了三个不同的命令:
  • 首先,创建 newuser WebSphere CloudBurst 用户。
  • newuser 电子邮件地址被修改为 newguy@mycompany.com
  • 最后,检索表示 newuser 的资源的当前状态。
通过使用多个 -c 参数,您可以构造一组有序的步骤,所有命令将按从左到右的顺序执行。
清单 12. 为 CLI 提供多个命令 - 命令
1
2
3
4
C:\cloudburst\cloudburst.cli>cloudburst -h wstiblade12.rtp.raleigh.ibm.com -u cb
admin -p cbadmin -c "newuser = cloudburst.users.create({'username':'newuser', 'fullname':'
Pattern Deployer', 'password':'password', 'email':'newuser@mycompany.com'})" -c
"newuser.email='newguy@mycompany.com'" -c "newuser”




清单 13. 为 CLI 提供多个命令 - 输出
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
  "currentmessage": "RM02013",
  "currentmessage_text": "User has not logged in yet",
  "currentstatus": "RM01062",
  "currentstatus_text": "Inactive",
  "email": "newuser@mycompany.com",
  "fullname": "Pattern Deployer",
  "groups": (nested object),
  "id": 7,
  "parts": (nested object),
  "password": (write-only),
  "patterns": (nested object),
  "roles": (nested object),
  "scripts": (nested object),
  "username": "newuser",
  "virtualimages": (nested object),
  "virtualsystems": (nested object)
}
{
  "currentmessage": "RM02013",
  "currentmessage_text": "User has not logged in yet",
  "currentstatus": "RM01062",
  "currentstatus_text": "Inactive",
  "email": "newguy@mycompany.com",
  "fullname": "Pattern Deployer",
  "groups": (nested object),
  "id": 7,
  "parts": (nested object),
  "password": (write-only),
  "patterns": (nested object),
  "roles": (nested object),
  "scripts": (nested object),
  "username": "newuser",
  "virtualimages": (nested object),
  "virtualsystems": (nested object)
}

返回列表