2 dyusae dyusae 于 2015.06.05 14:39 提问

各位大神好!! 这个方法为什么不行啊??

def delete_role_instances(self, service_name, deployment_name,
role_instance_names):
'''
Reinstalls the operating system on instances of web roles or worker
roles and initializes the storage resources that are used by them. If
you do not want to initialize storage resources, you can use
reimage_role_instance.

    service_name:
        Name of the hosted service.
    deployment_name:
        The name of the deployment.
    role_instance_names:
        List of role instance names.

各位大神好!!
这个方法为什么不行啊??

2个回答

hwnd_windows
hwnd_windows   2015.06.05 14:59

Python刚接触,不熟,只看懂了你注释了一半

WillShaoMSFT
WillShaoMSFT   Rxr 2015.06.08 18:41

您好,
我想知道您是怎么调用该方法的?据我所知,您可能需要先创建一个证书,并上传之Azure上,建议您参考该官方文档:
http://www.windowsazure.cn/documentation/articles/cloud-services-python-how-to-use-service-management/#Connect
同时,您可以参考该代码:

 from azure import *
from azure.servicemanagement import *

subscription_id = '***'
certificate_path = '***.cer'
service_name='cloudservice'
deployment_name='test'
role_instance_names='testinstance1'
sms = ServiceManagementService(subscription_id, certificate_path)
sms.delete_role_instances(service_name,deployment_name,role_instance_names);

同时建议您参考该REST 方法,https://msdn.microsoft.com/zh-cn/library/azure/dn469418.aspx
Python的SDK将该REST方法封装在类库servicemanagement 中,您也可以自己通过httprequest去调用该服务。
希望对您有所帮助。您也可以将您的错误信息和代码分享下,我们可以帮您更好的去解决问题。
Regards,
Will
如果您想进一步了解Windows Azure, Windows Azure 官网欢迎您的访问

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!