knife-azure 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +22 -0
- data/Guardfile +8 -0
- data/LICENSE +201 -0
- data/Rakefile +51 -0
- data/knife-azure.gemspec +106 -0
- data/lib/azure/connection.rb +75 -0
- data/lib/azure/deploy.rb +114 -0
- data/lib/azure/disk.rb +62 -0
- data/lib/azure/host.rb +90 -0
- data/lib/azure/image.rb +58 -0
- data/lib/azure/rest.rb +97 -0
- data/lib/azure/role.rb +182 -0
- data/lib/azure/utility.rb +29 -0
- data/lib/chef/knife/azure_base.rb +102 -0
- data/lib/chef/knife/azure_image_list.rb +58 -0
- data/lib/chef/knife/azure_server_create.rb +283 -0
- data/lib/chef/knife/azure_server_delete.rb +103 -0
- data/lib/chef/knife/azure_server_describe.rb +85 -0
- data/lib/chef/knife/azure_server_list.rb +70 -0
- data/lib/knife-azure/version.rb +7 -0
- data/readme.rdoc +210 -0
- data/spec/functional/deploys_test.rb +39 -0
- data/spec/functional/host_test.rb +22 -0
- data/spec/functional/images_list_test.rb +44 -0
- data/spec/functional/role_test.rb +16 -0
- data/spec/integration/role_lifecycle_test.rb +60 -0
- data/spec/spec_helper.rb +41 -0
- data/spec/unit/assets/create_deployment.xml +37 -0
- data/spec/unit/assets/create_deployment_in_progress.xml +1 -0
- data/spec/unit/assets/create_host.xml +7 -0
- data/spec/unit/assets/create_role.xml +54 -0
- data/spec/unit/assets/list_deployments_for_service000.xml +126 -0
- data/spec/unit/assets/list_deployments_for_service001.xml +166 -0
- data/spec/unit/assets/list_deployments_for_service002.xml +1 -0
- data/spec/unit/assets/list_deployments_for_service003.xml +1 -0
- data/spec/unit/assets/list_disks.xml +1 -0
- data/spec/unit/assets/list_hosts.xml +1 -0
- data/spec/unit/assets/list_images.xml +1 -0
- data/spec/unit/assets/post_success.xml +6 -0
- data/spec/unit/deploys_list_spec.rb +55 -0
- data/spec/unit/disks_spec.rb +44 -0
- data/spec/unit/hosts_spec.rb +55 -0
- data/spec/unit/images_spec.rb +35 -0
- data/spec/unit/query_azure_mock.rb +69 -0
- data/spec/unit/roles_create_spec.rb +82 -0
- data/spec/unit/roles_list_spec.rb +32 -0
- metadata +240 -0
@@ -0,0 +1,166 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<Deployment xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
|
3
|
+
<Name>deployment001</Name>
|
4
|
+
<DeploymentSlot>Production</DeploymentSlot>
|
5
|
+
<PrivateID>2b1f2f0a4b414088a0ec64d583d9c4b3</PrivateID>
|
6
|
+
<Status>Running</Status>
|
7
|
+
<Label>WkdWd2JHOTViV1Z1ZERBd01RPT0=</Label>
|
8
|
+
<Url>http://service001.cloudapp-preview.net/</Url>
|
9
|
+
<Configuration>PFNlcnZpY2VDb25maWd1cmF0aW9uIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zPSJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL1NlcnZpY2VIb3N0aW5nLzIwMDgvMTAvU2VydmljZUNvbmZpZ3VyYXRpb24iPg0KICA8Um9sZSBuYW1lPSJyb2xlMDAyIj4NCiAgICA8SW5zdGFuY2VzIGNvdW50PSIxIiAvPg0KICA8L1JvbGU+DQogIDxSb2xlIG5hbWU9InJvbGUwMDEiPg0KICAgIDxJbnN0YW5jZXMgY291bnQ9IjEiIC8+DQogIDwvUm9sZT4NCjwvU2VydmljZUNvbmZpZ3VyYXRpb24+</Configuration>
|
10
|
+
<RoleInstanceList>
|
11
|
+
<RoleInstance>
|
12
|
+
<RoleName>vm002</RoleName>
|
13
|
+
<InstanceName>vm002</InstanceName>
|
14
|
+
<InstanceStatus>ReadyRole</InstanceStatus>
|
15
|
+
<InstanceUpgradeDomain>0</InstanceUpgradeDomain>
|
16
|
+
<InstanceFaultDomain>0</InstanceFaultDomain>
|
17
|
+
<InstanceSize>ExtraSmall</InstanceSize>
|
18
|
+
<InstanceStateDetails/>
|
19
|
+
<IpAddress>10.26.198.146</IpAddress>
|
20
|
+
<InstanceEndpoints>
|
21
|
+
<InstanceEndpoint>
|
22
|
+
<Name>tcpport66</Name>
|
23
|
+
<Vip>65.52.251.57</Vip>
|
24
|
+
<PublicPort>66</PublicPort>
|
25
|
+
<LocalPort>66</LocalPort>
|
26
|
+
<Protocol>tcp</Protocol>
|
27
|
+
</InstanceEndpoint>
|
28
|
+
<InstanceEndpoint>
|
29
|
+
<Name>SSH</Name>
|
30
|
+
<Vip>65.52.249.191</Vip>
|
31
|
+
<PublicPort>22</PublicPort>
|
32
|
+
<LocalPort>22</LocalPort>
|
33
|
+
<Protocol>tcp</Protocol>
|
34
|
+
</InstanceEndpoint>
|
35
|
+
</InstanceEndpoints>
|
36
|
+
<PowerState>Started</PowerState>
|
37
|
+
<HostName>myVm2</HostName>
|
38
|
+
</RoleInstance>
|
39
|
+
<RoleInstance>
|
40
|
+
<RoleName>role002</RoleName>
|
41
|
+
<InstanceName>role002</InstanceName>
|
42
|
+
<InstanceStatus>RoleStateUnknown</InstanceStatus>
|
43
|
+
<InstanceUpgradeDomain>0</InstanceUpgradeDomain>
|
44
|
+
<InstanceFaultDomain>0</InstanceFaultDomain>
|
45
|
+
<InstanceSize>Small</InstanceSize>
|
46
|
+
<InstanceStateDetails/>
|
47
|
+
<IpAddress>10.26.196.201</IpAddress>
|
48
|
+
<InstanceEndpoints>
|
49
|
+
<InstanceEndpoint>
|
50
|
+
<Name>ssh</Name>
|
51
|
+
<Vip>65.52.249.191</Vip>
|
52
|
+
<PublicPort>23</PublicPort>
|
53
|
+
<LocalPort>22</LocalPort>
|
54
|
+
<Protocol>tcp</Protocol>
|
55
|
+
</InstanceEndpoint>
|
56
|
+
</InstanceEndpoints>
|
57
|
+
<PowerState>Started</PowerState>
|
58
|
+
<HostName>role002</HostName>
|
59
|
+
</RoleInstance>
|
60
|
+
<RoleInstance>
|
61
|
+
<RoleName>role001</RoleName>
|
62
|
+
<InstanceName>role001</InstanceName>
|
63
|
+
<InstanceStatus>ReadyRole</InstanceStatus>
|
64
|
+
<InstanceUpgradeDomain>0</InstanceUpgradeDomain>
|
65
|
+
<InstanceFaultDomain>0</InstanceFaultDomain>
|
66
|
+
<InstanceSize>Small</InstanceSize>
|
67
|
+
<InstanceStateDetails/>
|
68
|
+
<IpAddress>10.26.196.254</IpAddress>
|
69
|
+
<InstanceEndpoints>
|
70
|
+
<InstanceEndpoint>
|
71
|
+
<Name>ssh</Name>
|
72
|
+
<Vip>65.52.249.191</Vip>
|
73
|
+
<PublicPort>22</PublicPort>
|
74
|
+
<LocalPort>22</LocalPort>
|
75
|
+
<Protocol>tcp</Protocol>
|
76
|
+
</InstanceEndpoint>
|
77
|
+
</InstanceEndpoints>
|
78
|
+
<PowerState>Started</PowerState>
|
79
|
+
<HostName>role001</HostName>
|
80
|
+
</RoleInstance>
|
81
|
+
</RoleInstanceList>
|
82
|
+
<UpgradeDomainCount>1</UpgradeDomainCount>
|
83
|
+
<RoleList>
|
84
|
+
<Role>
|
85
|
+
<RoleName>vm002</RoleName>
|
86
|
+
<OsVersion>WA-GUEST-OS-1.18_201203-01</OsVersion>
|
87
|
+
<ConfigurationSets>
|
88
|
+
<ConfigurationSet i:type="NetworkConfigurationSet">
|
89
|
+
<ConfigurationSetType>NetworkConfiguration</ConfigurationSetType>
|
90
|
+
<InputEndpoints>
|
91
|
+
<InputEndpoint>
|
92
|
+
<Port>60657</Port>
|
93
|
+
<Protocol>tcp</Protocol>
|
94
|
+
<Vip>65.52.249.191</Vip>
|
95
|
+
</InputEndpoint>
|
96
|
+
</InputEndpoints>
|
97
|
+
<SubnetNames/>
|
98
|
+
</ConfigurationSet>
|
99
|
+
</ConfigurationSets>
|
100
|
+
</Role>
|
101
|
+
<Role i:type="PersistentVMRole">
|
102
|
+
<RoleName>role002</RoleName>
|
103
|
+
<OsVersion>WA-GUEST-OS-1.18_201203-01</OsVersion>
|
104
|
+
<RoleType>PersistentVMRole</RoleType>
|
105
|
+
<ConfigurationSets>
|
106
|
+
<ConfigurationSet i:type="NetworkConfigurationSet">
|
107
|
+
<ConfigurationSetType>NetworkConfiguration</ConfigurationSetType>
|
108
|
+
<InputEndpoints>
|
109
|
+
<InputEndpoint>
|
110
|
+
<LocalPort>22</LocalPort>
|
111
|
+
<Name>ssh</Name>
|
112
|
+
<Port>23</Port>
|
113
|
+
<Protocol>tcp</Protocol>
|
114
|
+
<Vip>65.52.249.191</Vip>
|
115
|
+
</InputEndpoint>
|
116
|
+
</InputEndpoints>
|
117
|
+
<SubnetNames/>
|
118
|
+
</ConfigurationSet>
|
119
|
+
</ConfigurationSets>
|
120
|
+
<DataVirtualHardDisks/>
|
121
|
+
<OSVirtualHardDisk>
|
122
|
+
<HostCaching>ReadWrite</HostCaching>
|
123
|
+
<DiskName>deployment001-role002-0-201241722728</DiskName>
|
124
|
+
<MediaLink>http://auxpreview104imagestore.blob.core.azure-preview.com/os-disks/disk002b</MediaLink>
|
125
|
+
<SourceImageName>SUSE__OpenSUSE64121-03192012-en-us-15GB</SourceImageName>
|
126
|
+
<OS>Linux</OS>
|
127
|
+
</OSVirtualHardDisk>
|
128
|
+
<RoleSize>Small</RoleSize>
|
129
|
+
</Role>
|
130
|
+
<Role i:type="PersistentVMRole">
|
131
|
+
<RoleName>role001</RoleName>
|
132
|
+
<OsVersion>WA-GUEST-OS-1.18_201203-01</OsVersion>
|
133
|
+
<RoleType>PersistentVMRole</RoleType>
|
134
|
+
<ConfigurationSets>
|
135
|
+
<ConfigurationSet i:type="NetworkConfigurationSet">
|
136
|
+
<ConfigurationSetType>NetworkConfiguration</ConfigurationSetType>
|
137
|
+
<InputEndpoints>
|
138
|
+
<InputEndpoint>
|
139
|
+
<LocalPort>22</LocalPort>
|
140
|
+
<Name>ssh</Name>
|
141
|
+
<Port>22</Port>
|
142
|
+
<Protocol>tcp</Protocol>
|
143
|
+
<Vip>65.52.249.191</Vip>
|
144
|
+
</InputEndpoint>
|
145
|
+
</InputEndpoints>
|
146
|
+
<SubnetNames/>
|
147
|
+
</ConfigurationSet>
|
148
|
+
</ConfigurationSets>
|
149
|
+
<DataVirtualHardDisks/>
|
150
|
+
<OSVirtualHardDisk>
|
151
|
+
<HostCaching>ReadWrite</HostCaching>
|
152
|
+
<DiskName>deployment001-role001-0-201241722113</DiskName>
|
153
|
+
<MediaLink>http://auxpreview104imagestore.blob.core.azure-preview.com/os-disks/disk001</MediaLink>
|
154
|
+
<SourceImageName>SUSE__OpenSUSE64121-03192012-en-us-15GB</SourceImageName>
|
155
|
+
<OS>Linux</OS>
|
156
|
+
</OSVirtualHardDisk>
|
157
|
+
<RoleSize>Small</RoleSize>
|
158
|
+
</Role>
|
159
|
+
</RoleList>
|
160
|
+
<SdkVersion>1.7</SdkVersion>
|
161
|
+
<Locked>false</Locked>
|
162
|
+
<RollbackAllowed>true</RollbackAllowed>
|
163
|
+
<CreatedTime>2012-04-17T22:01:10Z</CreatedTime>
|
164
|
+
<LastModifiedTime>2012-04-23T23:52:09Z</LastModifiedTime>
|
165
|
+
<ExtendedProperties/>
|
166
|
+
</Deployment>
|
@@ -0,0 +1 @@
|
|
1
|
+
<Deployment xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Name>testrequest</Name><DeploymentSlot>Production</DeploymentSlot><PrivateID>0f6204c7b38b457a913be856a23e3142</PrivateID><Status>Running</Status><Label>ZEdWemRHbHVkbUZzYVdSemRYTmw=</Label><Url>http://service002.cloudapp-preview.net/</Url><Configuration>PFNlcnZpY2VDb25maWd1cmF0aW9uIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zPSJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL1NlcnZpY2VIb3N0aW5nLzIwMDgvMTAvU2VydmljZUNvbmZpZ3VyYXRpb24iPg0KICA8Um9sZSBuYW1lPSJ2bTAxIj4NCiAgICA8SW5zdGFuY2VzIGNvdW50PSIxIiAvPg0KICA8L1JvbGU+DQo8L1NlcnZpY2VDb25maWd1cmF0aW9uPg==</Configuration><RoleInstanceList><RoleInstance><RoleName>vm01</RoleName><InstanceName>vm01</InstanceName><InstanceStatus>ReadyRole</InstanceStatus><InstanceUpgradeDomain>0</InstanceUpgradeDomain><InstanceFaultDomain>0</InstanceFaultDomain><InstanceSize>ExtraSmall</InstanceSize><InstanceStateDetails/><IpAddress>10.26.194.166</IpAddress><InstanceEndpoints><InstanceEndpoint><Name>SSH</Name><Vip>65.52.251.144</Vip><PublicPort>54047</PublicPort><LocalPort>22</LocalPort><Protocol>tcp</Protocol></InstanceEndpoint></InstanceEndpoints><PowerState>Started</PowerState><HostName>myVm</HostName></RoleInstance></RoleInstanceList><UpgradeDomainCount>1</UpgradeDomainCount><RoleList><Role i:type="PersistentVMRole"><RoleName>vm01</RoleName><OsVersion>WA-GUEST-OS-1.18_201203-01</OsVersion><RoleType>PersistentVMRole</RoleType><ConfigurationSets><ConfigurationSet i:type="NetworkConfigurationSet"><ConfigurationSetType>NetworkConfiguration</ConfigurationSetType><InputEndpoints><InputEndpoint><LocalPort>22</LocalPort><Name>SSH</Name><Port>54047</Port><Protocol>tcp</Protocol><Vip>65.52.251.144</Vip></InputEndpoint></InputEndpoints><SubnetNames/></ConfigurationSet></ConfigurationSets><DataVirtualHardDisks/><OSVirtualHardDisk><HostCaching>ReadWrite</HostCaching><DiskName>testrequest-vm01-0-2012423214252</DiskName><MediaLink>http://auxpreview104imagestore.blob.core.azure-preview.com/os-disks/disk004Test</MediaLink><SourceImageName>SUSE__OpenSUSE64121-03192012-en-us-15GB</SourceImageName><OS>Linux</OS></OSVirtualHardDisk><RoleSize>ExtraSmall</RoleSize></Role></RoleList><SdkVersion>1.7</SdkVersion><Locked>false</Locked><RollbackAllowed>false</RollbackAllowed><CreatedTime>2012-04-23T21:46:44Z</CreatedTime><LastModifiedTime>2012-04-23T21:56:47Z</LastModifiedTime><ExtendedProperties/></Deployment
|
@@ -0,0 +1 @@
|
|
1
|
+
<Error xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Code>ResourceNotFound</Code><Message>No deployments were found.</Message></Error
|
@@ -0,0 +1 @@
|
|
1
|
+
<Disks xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Disk><OS>Linux</OS><Location>Windows Azure Preview</Location><LogicalDiskSizeInGB>15</LogicalDiskSizeInGB><MediaLink>http://auxpreview104imagestore.blob.core.azure-preview.com/os-disks/disk104</MediaLink><Name>service002-role104-0-201257233812</Name><SourceImageName>SUSE__OpenSUSE64121-03192012-en-us-15GB</SourceImageName></Disk><Disk><OS>Linux</OS><Location>Windows Azure Preview</Location><LogicalDiskSizeInGB>15</LogicalDiskSizeInGB><MediaLink>http://auxpreview104imagestore.blob.core.azure-preview.com/os-disks/disk105</MediaLink><Name>service002-role105-0-201257235741</Name><SourceImageName>SUSE__OpenSUSE64121-03192012-en-us-15GB</SourceImageName></Disk><Disk><OS>Linux</OS><Location>Windows Azure Preview</Location><LogicalDiskSizeInGB>30</LogicalDiskSizeInGB><MediaLink>http://auxpreview104imagestore.blob.core.azure-preview.com/os-disks/disk106</MediaLink><Name>service002-role106-0-20125801047</Name><SourceImageName>OpenLogic__OpenLogic-CentOS-62-en-us-30GB</SourceImageName></Disk><Disk><OS>Linux</OS><Location>Windows Azure Preview</Location><LogicalDiskSizeInGB>15</LogicalDiskSizeInGB><MediaLink>http://auxpreview104imagestore.blob.core.azure-preview.com/os-disks/disk107</MediaLink><Name>service002-role107-0-20125814427</Name><SourceImageName>SUSE__OpenSUSE64121-03192012-en-us-15GB</SourceImageName></Disk><Disk><OS>Linux</OS><Location>Windows Azure Preview</Location><LogicalDiskSizeInGB>15</LogicalDiskSizeInGB><MediaLink>http://auxpreview104imagestore.blob.core.azure-preview.com/os-disks/disk108</MediaLink><Name>service002-role108-0-201258152913</Name><SourceImageName>SUSE__OpenSUSE64121-03192012-en-us-15GB</SourceImageName></Disk><Disk><OS>Linux</OS><Location>Windows Azure Preview</Location><LogicalDiskSizeInGB>15</LogicalDiskSizeInGB><MediaLink>http://auxpreview104imagestore.blob.core.azure-preview.com/os-disks/disk109</MediaLink><Name>service002-role109-0-201258165947</Name><SourceImageName>SUSE__OpenSUSE64121-03192012-en-us-15GB</SourceImageName></Disk><Disk><AttachedTo><DeploymentName>service002</DeploymentName><HostedServiceName>service002</HostedServiceName><RoleName>role119</RoleName></AttachedTo><OS>Linux</OS><Location>Windows Azure Preview</Location><LogicalDiskSizeInGB>30</LogicalDiskSizeInGB><MediaLink>http://auxpreview104imagestore.blob.core.azure-preview.com/os-disks/disk119</MediaLink><Name>service002-role119-0-201258172212</Name><SourceImageName>OpenLogic__OpenLogic-CentOS-62-en-us-30GB</SourceImageName></Disk><Disk><OS>Linux</OS><Location>Windows Azure Preview</Location><LogicalDiskSizeInGB>30</LogicalDiskSizeInGB><MediaLink>http://auxpreview104imagestore.blob.core.azure-preview.com/os-disks/disk120</MediaLink><Name>service002-role120-0-201258203045</Name><SourceImageName>OpenLogic__OpenLogic-CentOS-62-en-us-30GB</SourceImageName></Disk></Disks
|
@@ -0,0 +1 @@
|
|
1
|
+
<HostedServices xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><HostedService><Url>https://management-preview.core.windows-int.net/155a9851-88a8-49b4-98e4-58055f08f412/services/hostedservices/service001</Url><ServiceName>service001</ServiceName><HostedServiceProperties><Description>Explicitly created hosted service</Description><Location>Windows Azure Preview</Location><Label>c2VydmljZTAwMQ==</Label><Status>Created</Status><DateCreated>2012-04-17T21:56:23Z</DateCreated><DateLastModified>2012-04-17T22:01:08Z</DateLastModified><ExtendedProperties/></HostedServiceProperties></HostedService><HostedService><Url>https://management-preview.core.windows-int.net/155a9851-88a8-49b4-98e4-58055f08f412/services/hostedservices/service002</Url><ServiceName>service002</ServiceName><HostedServiceProperties><Description>Explicitly created hosted service</Description><Location>Windows Azure Preview</Location><Label>c2VydmljZTAwMg==</Label><Status>Created</Status><DateCreated>2012-04-17T22:27:08Z</DateCreated><DateLastModified>2012-04-23T21:42:47Z</DateLastModified><ExtendedProperties/></HostedServiceProperties></HostedService><HostedService><Url>https://management-preview.core.windows-int.net/155a9851-88a8-49b4-98e4-58055f08f412/services/hostedservices/service003</Url><ServiceName>service003</ServiceName><HostedServiceProperties><Description>Explicitly created hosted service</Description><Location>Windows Azure Preview</Location><Label>c2VydmljZTAwMw==</Label><Status>Created</Status><DateCreated>2012-04-19T20:17:26Z</DateCreated><DateLastModified>2012-04-19T20:17:25Z</DateLastModified><ExtendedProperties/></HostedServiceProperties></HostedService></HostedServices
|
@@ -0,0 +1 @@
|
|
1
|
+
<Images xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><OSImage><Category>Canonical</Category><Label>Ubuntu Server 12.04 20120519</Label><Name>CANONICAL__Canonical-Ubuntu-12-04-20120519-2012-05-19-en-us-30GB.vhd</Name><OS>Linux</OS><Eula>http://www.ubuntu.com/project/about-ubuntu/licensing</Eula><Description>Ubuntu Server 12.04 (Precise Pangolin) 20120519 Cloud Image</Description></OSImage><OSImage><Category>Microsoft</Category><Label>Windows Server 2008 R2 SP1, Nov 2011</Label><LogicalSizeInGB>30</LogicalSizeInGB><Name>MSFT__Windows-Server-2008-R2-SP1.11-29-2011</Name><OS>Windows</OS><Eula>http://www.microsoft.com</Eula><Description>Microsoft Windows Server 2008 R2 SP1</Description></OSImage><OSImage><Category>Microsoft</Category><Label>SQL Server 2012 Evaluation, Nov 2011</Label><LogicalSizeInGB>30</LogicalSizeInGB><Name>MSFT__Windows-Server-2008-R2-SP1-with-SQL-Server-2012-Eval.11-29-2011</Name><OS>Windows</OS><Eula>http://download.microsoft.com/download/A/A/7/AA73B8F4-5F4B-4C0B-94F4-FB238C92A916/ENU/SQL Server 2012 Evaluation.rtf</Eula><Description>Microsoft Windows 2008 R2 Service Pack 1 with SQL Server 2012 Evaluation Edition (64-bit). This version has licensing restrictions and cannot be used in production. Use of this version is limited to 6 months.</Description></OSImage><OSImage><Category>Microsoft</Category><Label>Windows Server 8 Beta, Mar 2012</Label><LogicalSizeInGB>30</LogicalSizeInGB><Name>MSFT__Windows-Server-8-Beta.en-us.30GB.2012-03-22</Name><OS>Windows</OS><Eula>http://msdn.microsoft.com/en-us/windows/apps/br229516</Eula><Description>The next release of Windows Server, Windows Server "8", offers businesses and hosting providers a scalable, dynamic, and multitenant-aware, cloud-optimized infrastructure. It securely connects across premises and allows IT Professionals to respond to business needs faster and more efficiently.</Description></OSImage><OSImage><Category>Microsoft</Category><Label>Windows Server 8 Beta, Feb 2012</Label><LogicalSizeInGB>40</LogicalSizeInGB><Name>MSFT__Windows-Server-8-Beta.2-17-2012</Name><OS>Windows</OS><Eula>http://www.microsoft.com</Eula><Description>The next release of Windows Server, Windows Server "8", offers businesses and hosting providers a scalable, dynamic, and multitenant-aware, cloud-optimized infrastructure. It securely connects across premises and allows IT Professionals to respond to business needs faster and more efficiently.</Description></OSImage><OSImage><Category>Microsoft</Category><Label>Windows Server 2008 R2 SP1, Mar 2012</Label><LogicalSizeInGB>30</LogicalSizeInGB><Name>MSFT__Windows-Server-2008-R2-SP1.en-us.30GB.2012-3-22</Name><OS>Windows</OS><Eula>http://msdn.microsoft.com/en-us/windows/apps/br229516</Eula><Description>Microsoft Windows 2008 R2 Service Pack 1 for IAAS</Description></OSImage><OSImage><Category>OpenLogic</Category><Label>CentOS 6.2 provided by OpenLogic</Label><Name>OpenLogic__OpenLogic-CentOS-62-20120509-en-us-30GB.vhd</Name><OS>Linux</OS><Eula>http://www.openlogic.com/azure/service-agreement.php</Eula><Description>This distribution of CentOS version 6.2 is provided by OpenLogic and contains an installation of the Basic Server packages.</Description></OSImage><OSImage><Category>SUSE</Category><Label>SUSE Linux Enterprise Server</Label><Name>SUSE__SUSE-Linux-Enterprise-Server-11SP2-20120521-en-us-30GB.vhd</Name><OS>Linux</OS><Eula>http://www.novell.com/licensing/eula/</Eula><Description>SUSE Linux Enterprise Server is a highly reliable, scalable, and secure server operating system, built to power mission-critical workloads in both physical and virtual environments. It is an affordable, interoperable, and manageable open source foundation. With it, enterprises can cost-effectively deliver core business services, enable secure networks, and simplify the management of their heterogeneous IT infrastructure, maximizing efficiency and value.</Description></OSImage><OSImage><Category>SUSE</Category><Label>OpenSUSE64-12.1-Beta</Label><Name>SUSE__OpenSUSE64121-03192012-en-us-15GB.vhd</Name><OS>Linux</OS><Eula>http://www.novell.com/licensing/eula/</Eula><Description>OpenSUSE Linux 64 Bits (IAAS M1 Preview)</Description></OSImage></Images
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/query_azure_mock')
|
3
|
+
|
4
|
+
describe "deploys" do
|
5
|
+
include AzureSpecHelper
|
6
|
+
include QueryAzureMock
|
7
|
+
before 'setup connection' do
|
8
|
+
setup_query_azure_mock
|
9
|
+
end
|
10
|
+
|
11
|
+
specify {@connection.deploys.all.length.should be > 0}
|
12
|
+
it 'each deployment should have values' do
|
13
|
+
@connection.deploys.all.each do |deploy|
|
14
|
+
deploy.name.should_not be_nil
|
15
|
+
deploy.status.should_not be_nil
|
16
|
+
deploy.url.should_not be_nil
|
17
|
+
deploy.roles.length.should be > 0
|
18
|
+
end
|
19
|
+
end
|
20
|
+
it 'each role should have values' do
|
21
|
+
@connection.deploys.all.each do |deploy|
|
22
|
+
#describe_deploy deploy
|
23
|
+
deploy.roles.each do |role|
|
24
|
+
#describe_role role
|
25
|
+
role.name.should_not be_nil
|
26
|
+
role.status.should_not be_nil
|
27
|
+
role.size.should_not be_nil
|
28
|
+
role.ipaddress.should_not be_nil
|
29
|
+
role.sshport.should_not be_nil
|
30
|
+
role.sshipaddress.should_not be_nil
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
def describe_deploy(deploy)
|
35
|
+
puts '============================='
|
36
|
+
puts 'deployed service: ' + deploy.hostedservicename + ' deployment: ' + deploy.name
|
37
|
+
end
|
38
|
+
def describe_role(role)
|
39
|
+
puts 'role: ' + role.name
|
40
|
+
puts 'status: ' + role.status
|
41
|
+
puts 'size: ' + role.size
|
42
|
+
puts 'ip address: ' + role.ipaddress
|
43
|
+
puts 'ssh port: ' + role.sshport
|
44
|
+
puts 'ssh ip address: ' + role.sshipaddress
|
45
|
+
role.tcpports.each do |port|
|
46
|
+
puts ' tcp: ' + port['Name'] + ' ' + port['Vip'] + ' ' +
|
47
|
+
port['PublicPort'] + ' ' + port['LocalPort']
|
48
|
+
end
|
49
|
+
role.udpports.each do |port|
|
50
|
+
puts ' udp: ' + port['Name'] + ' ' + port['Vip'] + ' ' +
|
51
|
+
port['PublicPort'] + ' ' + port['LocalPort']
|
52
|
+
end
|
53
|
+
puts '============================='
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/query_azure_mock')
|
3
|
+
|
4
|
+
describe "disks" do
|
5
|
+
include AzureSpecHelper
|
6
|
+
include QueryAzureMock
|
7
|
+
before 'setup connection' do
|
8
|
+
setup_query_azure_mock
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'mock with actually retrieved values' do
|
12
|
+
it "should find strings" do
|
13
|
+
items = @connection.disks.all
|
14
|
+
items.length.should be > 1
|
15
|
+
items.each do |disk|
|
16
|
+
disk.name.should_not be_nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
it "should contain an attached disk" do
|
20
|
+
items = @connection.disks.all
|
21
|
+
count = 0;
|
22
|
+
items.each do |item|
|
23
|
+
if item.attached == true
|
24
|
+
count += 1
|
25
|
+
end
|
26
|
+
end
|
27
|
+
count.should == 1
|
28
|
+
end
|
29
|
+
it "should contain unattached disks" do
|
30
|
+
items = @connection.disks.all
|
31
|
+
count = 0;
|
32
|
+
items.each do |item|
|
33
|
+
if item.attached == false
|
34
|
+
count += 1
|
35
|
+
end
|
36
|
+
end
|
37
|
+
count.should == 7
|
38
|
+
end
|
39
|
+
it "should clear all unattached disks" do
|
40
|
+
@connection.disks.clear_unattached
|
41
|
+
@deletecount.should == 7
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/query_azure_mock')
|
3
|
+
|
4
|
+
describe "hosts" do
|
5
|
+
include AzureSpecHelper
|
6
|
+
include QueryAzureMock
|
7
|
+
before 'setup connection' do
|
8
|
+
setup_query_azure_mock
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'get all hosts' do
|
12
|
+
specify {@connection.hosts.all.length.should be > 1}
|
13
|
+
it "entry fields should not be nil" do
|
14
|
+
items = @connection.hosts.all
|
15
|
+
items.each do |host|
|
16
|
+
host.name.should_not be_nil
|
17
|
+
host.url.should_not be_nil
|
18
|
+
host.label.should_not be_nil
|
19
|
+
host.dateCreated.should_not be_nil
|
20
|
+
host.description.should_not be_nil
|
21
|
+
host.location.should_not be_nil
|
22
|
+
host.dateModified.should_not be_nil
|
23
|
+
host.status.should_not be_nil
|
24
|
+
end
|
25
|
+
end
|
26
|
+
specify {@connection.hosts.exists("notExpectedName").should == false}
|
27
|
+
specify {@connection.hosts.exists("service001").should == true}
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'create a new host' do
|
31
|
+
it 'using explicit parameters it should pass in expected body' do
|
32
|
+
params = {:hosted_service_name=>'service003', 'hosted_service_description'=>'Explicitly created hosted service', 'hosted_service_location'=>'Windows Azure Preview'}
|
33
|
+
host = @connection.hosts.create(params)
|
34
|
+
@postname.should == 'hostedservices'
|
35
|
+
@postverb.should == 'post'
|
36
|
+
Nokogiri::XML(@postbody).should be_equivalent_to(Nokogiri::XML readFile('create_host.xml'))
|
37
|
+
end
|
38
|
+
it 'using default parameters it should pass in expected body' do
|
39
|
+
params = {:hosted_service_name=>'service003'}
|
40
|
+
host = @connection.hosts.create(params)
|
41
|
+
@postname.should == 'hostedservices'
|
42
|
+
@postverb.should == 'post'
|
43
|
+
Nokogiri::XML(@postbody).should be_equivalent_to(Nokogiri::XML readFile('create_host.xml'))
|
44
|
+
end
|
45
|
+
end
|
46
|
+
context 'delete a host' do
|
47
|
+
it 'should pass in correct name, verb, and body' do
|
48
|
+
@connection.hosts.delete('service001');
|
49
|
+
@deletename.should == 'hostedservices/service001'
|
50
|
+
@deleteverb.should == 'delete'
|
51
|
+
@deletebody.should == nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/query_azure_mock')
|
3
|
+
|
4
|
+
describe "images" do
|
5
|
+
include AzureSpecHelper
|
6
|
+
include QueryAzureMock
|
7
|
+
before 'setup connection' do
|
8
|
+
setup_query_azure_mock
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'mock with actually retrieved values' do
|
12
|
+
it "should find strings" do
|
13
|
+
items = @connection.images.all
|
14
|
+
items.length.should be > 1
|
15
|
+
items.each do |image|
|
16
|
+
image.category.should_not be_nil
|
17
|
+
image.label.should_not be_nil
|
18
|
+
image.name.should_not be_nil
|
19
|
+
image.os.should_not be_nil
|
20
|
+
image.eula.should_not be_nil
|
21
|
+
image.description.should_not be_nil
|
22
|
+
end
|
23
|
+
end
|
24
|
+
it "should contain a linux image" do
|
25
|
+
items = @connection.images.all
|
26
|
+
foundLinux = false
|
27
|
+
items.each do |item|
|
28
|
+
if item.os == 'Linux'
|
29
|
+
foundLinux = true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
foundLinux.should == true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
|
2
|
+
module QueryAzureMock
|
3
|
+
def setup_query_azure_mock
|
4
|
+
@getname = ''
|
5
|
+
@getverb = ''
|
6
|
+
@getbody = ''
|
7
|
+
|
8
|
+
@postname = ''
|
9
|
+
@postverb = ''
|
10
|
+
@postbody = ''
|
11
|
+
|
12
|
+
@deletename = ''
|
13
|
+
@deleteverb = ''
|
14
|
+
@deletebody = ''
|
15
|
+
@deletecount = 0
|
16
|
+
|
17
|
+
@receivedXML = Nokogiri::XML ''
|
18
|
+
@connection = Azure::Connection.new(TEST_PARAMS)
|
19
|
+
@connection.stub(:query_azure) do |name, verb, body|
|
20
|
+
Chef::Log.info 'calling web service:' + name
|
21
|
+
if verb == 'get' || verb == nil
|
22
|
+
retval = ''
|
23
|
+
if name == 'images'
|
24
|
+
retval = Nokogiri::XML readFile('list_images.xml')
|
25
|
+
elsif name == 'disks'
|
26
|
+
retval = Nokogiri::XML readFile('list_disks.xml')
|
27
|
+
elsif name == 'hostedservices'
|
28
|
+
retval = Nokogiri::XML readFile('list_hosts.xml')
|
29
|
+
elsif name == 'hostedservices/service001/deploymentslots/Production'
|
30
|
+
retval = Nokogiri::XML readFile('list_deployments_for_service001.xml')
|
31
|
+
elsif name == 'hostedservices/service002/deploymentslots/Production'
|
32
|
+
retval = Nokogiri::XML readFile('list_deployments_for_service002.xml')
|
33
|
+
elsif name == 'hostedservices/service003/deploymentslots/Production'
|
34
|
+
retval = Nokogiri::XML readFile('list_deployments_for_service003.xml')
|
35
|
+
else
|
36
|
+
Chef::Log.warn 'unknown get value:' + name
|
37
|
+
end
|
38
|
+
@getname = name
|
39
|
+
@getverb = verb
|
40
|
+
@getbody = body
|
41
|
+
elsif verb == 'post'
|
42
|
+
if name == 'hostedservices'
|
43
|
+
retval = Nokogiri::XML readFile('post_success.xml')
|
44
|
+
@receivedXML = body
|
45
|
+
elsif name == 'hostedservices/unknown_yet/deployments'
|
46
|
+
retval = Nokogiri::XML readFile('post_success.xml')
|
47
|
+
@receivedXML = body
|
48
|
+
elsif name == 'hostedservices/service001/deployments/deployment001/roles'
|
49
|
+
retval = Nokogiri::XML readFile('post_success.xml')
|
50
|
+
@receivedXML = body
|
51
|
+
else
|
52
|
+
Chef::Log.warn 'unknown post value:' + name
|
53
|
+
end
|
54
|
+
@postname = name
|
55
|
+
@postverb = verb
|
56
|
+
@postbody = body
|
57
|
+
elsif verb == 'delete'
|
58
|
+
@deletename = name
|
59
|
+
@deleteverb = verb
|
60
|
+
@deletebody = body
|
61
|
+
@deletecount += 1
|
62
|
+
else
|
63
|
+
Chef::Log.warn 'unknown verb:' + verb
|
64
|
+
end
|
65
|
+
retval
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/query_azure_mock')
|
3
|
+
|
4
|
+
describe "roles" do
|
5
|
+
include AzureSpecHelper
|
6
|
+
include QueryAzureMock
|
7
|
+
before do
|
8
|
+
setup_query_azure_mock
|
9
|
+
end
|
10
|
+
context 'delete a role' do
|
11
|
+
context 'when the role is not the only one in a deployment' do
|
12
|
+
it 'should pass in correct name, verb, and body' do
|
13
|
+
@connection.roles.delete('vm002');
|
14
|
+
@deletename.should == 'hostedservices/service001/deployments/deployment001/roles/vm002'
|
15
|
+
@deleteverb.should == 'delete'
|
16
|
+
@deletebody.should == nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
context 'delete a role' do
|
21
|
+
context 'when the role is the only one in a deployment' do
|
22
|
+
it 'should pass in correct name, verb, and body' do
|
23
|
+
@connection.roles.delete('vm01');
|
24
|
+
@deletename.should == 'hostedservices/service002/deployments/testrequest'
|
25
|
+
@deleteverb.should == 'delete'
|
26
|
+
@deletebody.should == nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
context 'create a new role' do
|
31
|
+
it 'should pass in expected body' do
|
32
|
+
submittedXML=Nokogiri::XML readFile('create_role.xml')
|
33
|
+
params = {
|
34
|
+
:hosted_service_name=>'service001',
|
35
|
+
:role_name=>'vm01',
|
36
|
+
:host_name=>'myVm',
|
37
|
+
:ssh_user=>'jetstream',
|
38
|
+
:ssh_password=>'jetstream1!',
|
39
|
+
:media_location_prefix=>'auxpreview104',
|
40
|
+
:os_disk_name=>'disk004Test',
|
41
|
+
:source_image=>'SUSE__OpenSUSE64121-03192012-en-us-15GB',
|
42
|
+
:role_size=>'ExtraSmall',
|
43
|
+
:tcp_endpoints=>'44:45,55:55',
|
44
|
+
:udp_endpoints=>'65:65,75'
|
45
|
+
|
46
|
+
}
|
47
|
+
deploy = @connection.deploys.create(params)
|
48
|
+
#this is a cheesy workaround to make equivalent-xml happy
|
49
|
+
# write and then re-read the xml
|
50
|
+
File.open(tmpFile('newRoleRcvd.xml'), 'w') {|f| f.write(@receivedXML) }
|
51
|
+
File.open(tmpFile('newRoleSbmt.xml'), 'w') {|f| f.write(submittedXML.to_xml) }
|
52
|
+
rcvd = Nokogiri::XML File.open(tmpFile('newRoleRcvd.xml'))
|
53
|
+
sbmt = Nokogiri::XML File.open(tmpFile('newRoleSbmt.xml'))
|
54
|
+
rcvd.should be_equivalent_to(sbmt).respecting_element_order.with_whitespace_intact
|
55
|
+
end
|
56
|
+
end
|
57
|
+
context 'create a new deployment' do
|
58
|
+
it 'should pass in expected body' do
|
59
|
+
submittedXML=Nokogiri::XML readFile('create_deployment.xml')
|
60
|
+
params = {
|
61
|
+
:hosted_service_name=>'unknown_yet',
|
62
|
+
:role_name=>'vm01',
|
63
|
+
:host_name=>'myVm',
|
64
|
+
:ssh_user=>'jetstream',
|
65
|
+
:ssh_password=>'jetstream1!',
|
66
|
+
:media_location_prefix=>'auxpreview104',
|
67
|
+
:os_disk_name=>'disk004Test',
|
68
|
+
:source_image=>'SUSE__OpenSUSE64121-03192012-en-us-15GB',
|
69
|
+
:role_size=>'ExtraSmall'
|
70
|
+
|
71
|
+
}
|
72
|
+
deploy = @connection.deploys.create(params)
|
73
|
+
#this is a cheesy workaround to make equivalent-xml happy
|
74
|
+
# write and then re-read the xml
|
75
|
+
File.open(tmpFile('newDeployRcvd.xml'), 'w') {|f| f.write(@receivedXML) }
|
76
|
+
File.open(tmpFile('newDeploySbmt.xml'), 'w') {|f| f.write(submittedXML.to_xml) }
|
77
|
+
rcvd = Nokogiri::XML File.open(tmpFile('newDeployRcvd.xml'))
|
78
|
+
sbmt = Nokogiri::XML File.open(tmpFile('newDeploySbmt.xml'))
|
79
|
+
rcvd.should be_equivalent_to(sbmt).respecting_element_order
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/query_azure_mock')
|
3
|
+
describe "roles" do
|
4
|
+
include AzureSpecHelper
|
5
|
+
include QueryAzureMock
|
6
|
+
before do
|
7
|
+
setup_query_azure_mock
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'show all roles' do
|
11
|
+
roles = @connection.roles.all
|
12
|
+
roles.each do |role|
|
13
|
+
role.name.should_not be_nil
|
14
|
+
end
|
15
|
+
roles.length.should == 4
|
16
|
+
end
|
17
|
+
specify {@connection.roles.exists('vm01').should == true}
|
18
|
+
specify {@connection.roles.exists('vm002').should == true}
|
19
|
+
specify {@connection.roles.exists('role001').should == true}
|
20
|
+
specify {@connection.roles.exists('role002').should == true}
|
21
|
+
specify {@connection.roles.exists('role002qqqqq').should == false}
|
22
|
+
|
23
|
+
it 'each role should have values' do
|
24
|
+
role = @connection.roles.find('vm01')
|
25
|
+
role.name.should_not be_nil
|
26
|
+
role.status.should_not be_nil
|
27
|
+
role.size.should_not be_nil
|
28
|
+
role.ipaddress.should_not be_nil
|
29
|
+
role.sshport.should_not be_nil
|
30
|
+
role.sshipaddress.should_not be_nil
|
31
|
+
end
|
32
|
+
end
|