Softlayer Post ProvisiopostInstallScriptUri

时间:2017-04-19 19:17:47

标签: ibm-cloud-infrastructure

使用Softlayer cli或Web门户在Softlayer中进行VM配置后,后配置脚本不会下载到VM中。是否有可以打开调试标志以解决将后配置脚本下载到VM的问题?

c:/ PostScript文件夹仅在VM ithBuildINI,postscript和wget文件上创建。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

首先验证postscript的URL是否已经存在,如果您的postscript已在另一个环境中成功下载,我建议您提交一个票据以进行审核。

无法知道下载失败的时间,它在VM配置期间由服务器处理。

有两种方法可以重复下载过程:

a)执行方法SoftLayer_Virtual_Guest::executeRemoteScript

成功时返回NULL,如果失败则返回异常:

Script download failed. Could not confirm file downloaded correctly.

脚本直接在单元C中下载,还有一个名为postInstallScript_Download.txt的日志文件。 在VSI配置后(当它为ON时)使用此方法。您可以在python中使用以下示例来测试此方法。

"""
Download and run remote script from uri on virtual guests.
This returns NULL when success and an exception like this if fails:
    "Script download failed. Could not confirm file downloaded correctly."
See below for more details.

Important manual pages:
http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/executeRemoteScript

License: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <sldn@softlayer.com>
"""

import SoftLayer

USERNAME = 'set me'
API_KEY = 'set me'

# The virtual guest ID.
guestId = 31003555

# Declares a new API service object.
client = SoftLayer.create_client_from_env(username=USERNAME, api_key=API_KEY)
virtualGuestService = client['SoftLayer_Virtual_Guest']

# URL where is hosted the script you want to download.
uri = "http://www.example.com/test_container/folder/startNotepad.cmd"

try:
    result = virtualGuestService.executeRemoteScript(uri, id=guestId)
    print("File was downloaded!!")
except SoftLayer.SoftLayerAPIError as e:
    print("Error: %s, %s" % (e.faultCode, e.faultString))
    exit(1)

使用您自己的数据更改 31003555 http://www.example.com/test_container/folder/startNotepad.cmd

b)通过门户网站或cli重新加载操作系统

我建议使用门户网站,只需要设置postscript网址,服务就会自动设置以前的配置,如操作系统,防火墙等。

考虑到重新加载将格式化主磁盘并将计算实例重新配置为记录中的规范。在这种情况下,也无法知道下载过程何时失败。

您可以在此处找到有关如何重新加载和添加后脚本的信息: https://knowledgelayer.softlayer.com/procedure/perform-os-reload https://knowledgelayer.softlayer.com/procedure/os-reloads

您也可以查看:
https://knowledgelayer.softlayer.com/procedure/add-custom-provisioning-script https://knowledgelayer.softlayer.com/procedure/add-provisioning-script https://knowledgelayer.softlayer.com/faq/what-difference-between-using-http-or-https-url-my-provisioning-script

我希望这对你有所帮助。

问候。