Index: trunk/extensions/OpenStackManager/SpecialNovaInstance.php |
— | — | @@ -64,12 +64,13 @@ |
65 | 65 | global $wgOpenStackManagerPuppetOptions; |
66 | 66 | |
67 | 67 | $this->setHeaders(); |
68 | | - $wgOut->setPagetitle("Create Instance"); |
| 68 | + $wgOut->setPagetitle( wfMsg('openstackmanager-createinstance') ); |
69 | 69 | |
70 | 70 | $instanceInfo = Array(); |
71 | 71 | $instanceInfo['instancename'] = array( |
72 | 72 | 'type' => 'text', |
73 | | - 'label-message' => 'instancename', |
| 73 | + 'label-message' => 'openstackmanager-instancename', |
| 74 | + 'validation-callback' => array( $this, 'validateInstanceName' ), |
74 | 75 | 'default' => '', |
75 | 76 | 'section' => 'instance/info', |
76 | 77 | ); |
— | — | @@ -81,9 +82,9 @@ |
82 | 83 | } |
83 | 84 | $instanceInfo['instanceType'] = array( |
84 | 85 | 'type' => 'select', |
| 86 | + 'label-message' => 'openstackmanager-instancetype', |
85 | 87 | 'section' => 'instance/info', |
86 | 88 | 'options' => $instanceType_keys, |
87 | | - 'label-message' => 'instancetype', |
88 | 89 | ); |
89 | 90 | |
90 | 91 | # Availability zone names can't be translated. Get the keys, and make an array |
— | — | @@ -97,7 +98,7 @@ |
98 | 99 | 'type' => 'select', |
99 | 100 | 'section' => 'instance/info', |
100 | 101 | 'options' => $availabilityZone_keys, |
101 | | - 'label-message' => 'availabilityzone', |
| 102 | + 'label-message' => 'openstackmanager-availabilityzone', |
102 | 103 | ); |
103 | 104 | |
104 | 105 | # Image names can't be translated. Get the image, and make an array |
— | — | @@ -111,7 +112,7 @@ |
112 | 113 | 'type' => 'select', |
113 | 114 | 'section' => 'instance/info', |
114 | 115 | 'options' => $image_keys, |
115 | | - 'label-message' => 'imagetype', |
| 116 | + 'label-message' => 'openstackmanager-imagetype', |
116 | 117 | ); |
117 | 118 | |
118 | 119 | # Keypair names can't be translated. Get the keys, and make an array |
— | — | @@ -129,7 +130,7 @@ |
130 | 131 | # 'label-message' => 'keypair', |
131 | 132 | #); |
132 | 133 | |
133 | | - $domains = OpenStackNovaDomain::getAllDomains(); |
| 134 | + $domains = OpenStackNovaDomain::getAllDomains( true ); |
134 | 135 | $domain_keys = array(); |
135 | 136 | foreach ( $domains as $domain ) { |
136 | 137 | $domainname = $domain->getDomainName(); |
— | — | @@ -139,7 +140,7 @@ |
140 | 141 | 'type' => 'select', |
141 | 142 | 'section' => 'instance/info', |
142 | 143 | 'options' => $domain_keys, |
143 | | - 'label-message' => 'domain', |
| 144 | + 'label-message' => 'openstackmanager-dnsdomain', |
144 | 145 | ); |
145 | 146 | |
146 | 147 | $instanceInfo['project'] = array( |
— | — | @@ -157,7 +158,7 @@ |
158 | 159 | 'type' => 'multiselect', |
159 | 160 | 'section' => 'instance/puppetinfo', |
160 | 161 | 'options' => $classes, |
161 | | - 'label-message' => 'puppetclasses', |
| 162 | + 'label-message' => 'openstackmanager-puppetclasses', |
162 | 163 | ); |
163 | 164 | } |
164 | 165 | |
— | — | @@ -177,9 +178,9 @@ |
178 | 179 | 'default' => 'create', |
179 | 180 | ); |
180 | 181 | |
181 | | - $instanceForm = new SpecialNovaInstanceForm( $instanceInfo, 'novainstance-form' ); |
| 182 | + $instanceForm = new SpecialNovaInstanceForm( $instanceInfo, 'openstackmanager-novainstance' ); |
182 | 183 | $instanceForm->setTitle( SpecialPage::getTitleFor( 'NovaInstance' )); |
183 | | - $instanceForm->setSubmitID( 'novainstance-form-createinstancesubmit' ); |
| 184 | + $instanceForm->setSubmitID( 'openstackmanager-novainstance-createinstancesubmit' ); |
184 | 185 | $instanceForm->setSubmitCallback( array( $this, 'tryCreateSubmit' ) ); |
185 | 186 | $instanceForm->show(); |
186 | 187 | |
— | — | @@ -313,6 +314,7 @@ |
314 | 315 | $header .= Html::element( 'th', array(), 'Instance ID' ); |
315 | 316 | $header .= Html::element( 'th', array(), 'Instance State' ); |
316 | 317 | $header .= Html::element( 'th', array(), 'Instance Type' ); |
| 318 | + $header .= Html::element( 'th', array(), 'Instance IP' ); |
317 | 319 | $header .= Html::element( 'th', array(), 'Image ID' ); |
318 | 320 | $header .= Html::element( 'th', array(), 'Actions' ); |
319 | 321 | $projectArr = array(); |
— | — | @@ -324,11 +326,12 @@ |
325 | 327 | $instanceName = (string)$instance->getInstanceName(); |
326 | 328 | $title = Title::newFromText( $instanceName, NS_VM ); |
327 | 329 | $instanceNameLink = $sk->link( $title, $instanceName, array(), array(), array() ); |
328 | | - $projectArr["$project"] = Html::rawElement( 'td', array(), $instanceNameLink ); |
329 | | - $projectArr["$project"] .= Html::element( 'td', array(), $instance->getInstanceId() ); |
330 | | - $projectArr["$project"] .= Html::element( 'td', array(), $instance->getInstanceState() ); |
331 | | - $projectArr["$project"] .= Html::element( 'td', array(), $instance->getInstanceType() ); |
332 | | - $projectArr["$project"] .= Html::element( 'td', array(), $instance->getImageId() ); |
| 330 | + $instanceOut = Html::rawElement( 'td', array(), $instanceNameLink ); |
| 331 | + $instanceOut .= Html::element( 'td', array(), $instance->getInstanceId() ); |
| 332 | + $instanceOut .= Html::element( 'td', array(), $instance->getInstanceState() ); |
| 333 | + $instanceOut .= Html::element( 'td', array(), $instance->getInstanceType() ); |
| 334 | + $instanceOut .= Html::element( 'td', array(), $instance->getInstancePrivateIP() ); |
| 335 | + $instanceOut .= Html::element( 'td', array(), $instance->getImageId() ); |
333 | 336 | $actions = $sk->link( $this->getTitle(), 'delete', array(), |
334 | 337 | array( 'action' => 'delete', |
335 | 338 | 'project' => $project, |
— | — | @@ -346,7 +349,8 @@ |
347 | 350 | 'project' => $project, |
348 | 351 | 'instanceid' => $instance->getInstanceId() ), |
349 | 352 | array() ); |
350 | | - $projectArr["$project"] .= Html::rawElement( 'td', array(), $actions ); |
| 353 | + $instanceOut .= Html::rawElement( 'td', array(), $actions ); |
| 354 | + $projectArr["$project"] .= Html::rawElement( 'tr', array(), $instanceOut ); |
351 | 355 | } |
352 | 356 | foreach ( $userProjects as $project ) { |
353 | 357 | $out .= Html::element( 'h2', array(), $project ); |
— | — | @@ -354,7 +358,7 @@ |
355 | 359 | array( 'action' => 'create', 'project' => $project ), array() ); |
356 | 360 | if ( isset( $projectArr["$project"] ) ) { |
357 | 361 | $projectOut = $header; |
358 | | - $projectOut .= Html::rawElement( 'tr', array(), $projectArr["$project"] ); |
| 362 | + $projectOut .= $projectArr["$project"]; |
359 | 363 | $out .= Html::rawElement( 'table', |
360 | 364 | array( 'id' => 'novainstancelist', 'class' => 'wikitable' ), $projectOut ); |
361 | 365 | } |
— | — | @@ -371,6 +375,7 @@ |
372 | 376 | $domain = OpenStackNovaDomain::getDomainByName( $formData['domain'] ); |
373 | 377 | if ( ! $domain ) { |
374 | 378 | $out = Html::element( 'p', array(), 'Requested domain is invalid' ); |
| 379 | + return false; |
375 | 380 | } |
376 | 381 | $instance = $this->userNova->createInstance( $formData['instancename'], $formData['imageType'], '', $formData['instanceType'], $formData['availabilityZone'] ); |
377 | 382 | if ( $instance ) { |
— | — | @@ -388,8 +393,12 @@ |
389 | 394 | } |
390 | 395 | } |
391 | 396 | $host = OpenStackNovaHost::addHost( $instance, $domain, $puppetinfo ); |
| 397 | + |
392 | 398 | if ( $host ) { |
393 | | - $out = Html::element( 'p', array(), 'Created instance ' . $instance->getInstanceID() . ' with image ' . $instance->getImageId() . ' and hostname ' . $host->getFullyQualifiedHostName() . ' and ip ' . $instance->getInstancePrivateIP() ); |
| 399 | + $title = Title::newFromText( $wgOut->getPageTitle() ); |
| 400 | + $job = new OpenStackNovaHostJob( $title, array( 'instanceid' => (string)$instance->getInstanceId() ) ); |
| 401 | + $job->insert(); |
| 402 | + $out = Html::element( 'p', array(), 'Created instance ' . $instance->getInstanceID() . ' with image ' . $instance->getImageId() . ' and hostname ' . $host->getFullyQualifiedHostName() ); |
394 | 403 | } else { |
395 | 404 | $this->userNova->terminateInstance( $instance->getInstanceId() ); |
396 | 405 | $out = Html::element( 'p', array(), 'Failed to create instance as the host could not be added to LDAP' ); |
— | — | @@ -407,20 +416,24 @@ |
408 | 417 | function tryDeleteSubmit( $formData, $entryPoint = 'internal' ) { |
409 | 418 | global $wgOut, $wgUser; |
410 | 419 | |
| 420 | + $sk = $wgUser->getSkin(); |
411 | 421 | $instance = $this->adminNova->getInstance( $formData['instanceid'] ); |
| 422 | + if ( ! $instance ) { |
| 423 | + $out = Html::element( 'p', array(), 'The instance requested does not exist.' ); |
| 424 | + return true; |
| 425 | + } |
412 | 426 | $instancename = $instance->getInstanceName(); |
413 | 427 | $instanceid = $instance->getInstanceId(); |
414 | | - $success = $this->userNova->terminateInstance( $formData['instanceid'] ); |
415 | | - $sk = $wgUser->getSkin(); |
| 428 | + $success = $this->userNova->terminateInstance( $instanceid ); |
416 | 429 | if ( $success ) { |
417 | 430 | $success = OpenStackNovaHost::deleteHostByInstanceId( $instanceid ); |
418 | 431 | if ( $success ) { |
419 | | - $out = Html::element( 'p', array(), "Deleted instance $instancename" ); |
| 432 | + $out = Html::element( 'p', array(), "Deleted instance $instanceid" ); |
420 | 433 | } else { |
421 | | - $out = Html::element( 'p', array(), "Successfully deleted instance, but failed to remove $instancename DNS entry" ); |
| 434 | + $out = Html::element( 'p', array(), "Successfully deleted instance, but failed to remove $instancename DNS entry for instance $instanceid" ); |
422 | 435 | } |
423 | 436 | } else { |
424 | | - $out = Html::element( 'p', array(), 'Failed to create instance' ); |
| 437 | + $out = Html::element( 'p', array(), 'Failed to delete instance' ); |
425 | 438 | } |
426 | 439 | $out .= $sk->link( $this->getTitle(), 'Back to instance list', array(), array(), array() ); |
427 | 440 | |
— | — | @@ -463,6 +476,14 @@ |
464 | 477 | return true; |
465 | 478 | } |
466 | 479 | |
| 480 | + function validateInstanceName( $instancename, $alldata ) { |
| 481 | + if ( ! preg_match( "/^[a-z][a-z0-9\-]*$/", $instancename ) ) { |
| 482 | + return Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'openstackmanager-badinstancename' ) ); |
| 483 | + } else { |
| 484 | + return true; |
| 485 | + } |
| 486 | + } |
| 487 | + |
467 | 488 | } |
468 | 489 | |
469 | 490 | class SpecialNovaInstanceForm extends HTMLForm { |
Index: trunk/extensions/OpenStackManager/SpecialNovaProject.php |
— | — | @@ -34,6 +34,7 @@ |
35 | 35 | # return false; |
36 | 36 | #} |
37 | 37 | if ( ! $wgUser->isLoggedIn() ) { |
| 38 | + $this->notLoggedIn(); |
38 | 39 | return false; |
39 | 40 | } |
40 | 41 | |
— | — | @@ -207,6 +208,9 @@ |
208 | 209 | $projectsOut .= Html::element( 'th', array(), 'Members' ); |
209 | 210 | $projectsOut .= Html::element( 'th', array(), 'Action' ); |
210 | 211 | $projects = OpenStackNovaProject::getAllProjects(); |
| 212 | + if ( ! $projects ) { |
| 213 | + $projectsOut = ''; |
| 214 | + } |
211 | 215 | foreach ( $projects as $project ) { |
212 | 216 | $projectName = $project->getProjectName(); |
213 | 217 | $projectOut = Html::element( 'td', array(), $projectName ); |
— | — | @@ -218,17 +222,21 @@ |
219 | 223 | $projectMemberOut = htmlentities( $projectMember) . ' (' . $link . ')'; |
220 | 224 | $memberOut .= Html::rawElement( 'li', array(), $projectMemberOut ); |
221 | 225 | } |
222 | | - $memberOut .= '<br />'; |
| 226 | + if ( $memberOut ) { |
| 227 | + $memberOut .= '<br />'; |
| 228 | + $memberOut = Html::rawElement( 'ul', array(), $memberOut ); |
| 229 | + } |
223 | 230 | $memberOut .= $sk->link( $this->getTitle(), 'Add a member', array(), |
224 | 231 | array( 'action' => 'addmember', 'projectname' => $projectName ), array() ); |
225 | | - $membersOut = Html::rawElement( 'ul', array(), $memberOut ); |
226 | | - $projectOut .= Html::rawElement( 'td', array(), $membersOut ); |
| 232 | + $projectOut .= Html::rawElement( 'td', array(), $memberOut ); |
227 | 233 | $link = $sk->link( $this->getTitle(), 'delete project', array(), |
228 | 234 | array( 'action' => 'delete', 'projectname' => $projectName ), array() ); |
229 | 235 | $projectOut .= Html::rawElement( 'td', array(), $link ); |
230 | 236 | $projectsOut .= Html::rawElement( 'tr', array(), $projectOut ); |
231 | 237 | } |
232 | | - $out .= Html::rawElement( 'table', array( 'class' => 'wikitable' ), $projectsOut ); |
| 238 | + if ( $projectsOut ) { |
| 239 | + $out .= Html::rawElement( 'table', array( 'class' => 'wikitable' ), $projectsOut ); |
| 240 | + } |
233 | 241 | |
234 | 242 | $wgOut->addHTML( $out ); |
235 | 243 | } |
Index: trunk/extensions/OpenStackManager/SpecialNovaDomain.php |
— | — | @@ -23,6 +23,7 @@ |
24 | 24 | # return false; |
25 | 25 | #} |
26 | 26 | if ( ! $wgUser->isLoggedIn() ) { |
| 27 | + $this->notLoggedIn(); |
27 | 28 | return false; |
28 | 29 | } |
29 | 30 | |
— | — | @@ -36,8 +37,16 @@ |
37 | 38 | } |
38 | 39 | } |
39 | 40 | |
| 41 | + function notLoggedIn() { |
| 42 | + global $wgOut; |
| 43 | + $this->setHeaders(); |
| 44 | + $wgOut->setPagetitle("Not logged in"); |
| 45 | + $wgOut->addHTML('<p>You must be logged in to perform this action</p>'); |
| 46 | + } |
| 47 | + |
40 | 48 | function createDomain() { |
41 | 49 | global $wgRequest, $wgOut; |
| 50 | + global $wgOpenStackManagerDNSOptions; |
42 | 51 | |
43 | 52 | $this->setHeaders(); |
44 | 53 | $wgOut->setPagetitle("Create Domain"); |
— | — | @@ -55,8 +64,12 @@ |
56 | 65 | 'default' => '', |
57 | 66 | 'section' => 'domain/info', |
58 | 67 | ); |
59 | | - |
60 | | - |
| 68 | + $domainInfo['location'] = array( |
| 69 | + 'type' => 'text', |
| 70 | + 'label-message' => 'location', |
| 71 | + 'default' => '', |
| 72 | + 'section' => 'domain/info', |
| 73 | + ); |
61 | 74 | $domainInfo['action'] = array( |
62 | 75 | 'type' => 'hidden', |
63 | 76 | 'default' => 'create', |
— | — | @@ -111,21 +124,26 @@ |
112 | 125 | $out = ''; |
113 | 126 | $sk = $wgUser->getSkin(); |
114 | 127 | $out .= $sk->link( $this->getTitle(), 'Create a new domain', array(), array( 'action' => 'create' ), array() ); |
115 | | - $domainsOut = Html::element( 'th', array(), 'Domain name' ); |
116 | | - $domainsOut .= Html::element( 'th', array(), 'FQDN' ); |
117 | | - $domainsOut .= Html::element( 'th', array(), 'Action' ); |
| 128 | + $domainsOut = Html::element( 'th', array(), 'Domain name' ); |
| 129 | + $domainsOut .= Html::element( 'th', array(), 'FQDN' ); |
| 130 | + $domainsOut .= Html::element( 'th', array(), 'Location' ); |
| 131 | + $domainsOut .= Html::element( 'th', array(), 'Action' ); |
118 | 132 | $domains = OpenStackNovaDomain::getAllDomains(); |
119 | 133 | foreach ( $domains as $domain ) { |
120 | 134 | $domainName = $domain->getDomainName(); |
121 | 135 | $fqdn = $domain->getFullyQualifiedDomainName(); |
| 136 | + $location = $domain->getLocation(); |
122 | 137 | $domainOut = Html::element( 'td', array(), $domainName ); |
123 | 138 | $domainOut .= Html::element( 'td', array(), $fqdn ); |
| 139 | + $domainOut .= Html::element( 'td', array(), $location ); |
124 | 140 | $link = $sk->link( $this->getTitle(), 'delete domain', array(), |
125 | 141 | array( 'action' => 'delete', 'domainname' => $domainName ), array() ); |
126 | 142 | $domainOut .= Html::rawElement( 'td', array(), $link ); |
127 | 143 | $domainsOut .= Html::rawElement( 'tr', array(), $domainOut ); |
128 | 144 | } |
129 | | - $out .= Html::rawElement( 'table', array( 'class' => 'wikitable' ), $domainsOut ); |
| 145 | + if ( $domains ) { |
| 146 | + $out .= Html::rawElement( 'table', array( 'class' => 'wikitable' ), $domainsOut ); |
| 147 | + } |
130 | 148 | |
131 | 149 | $wgOut->addHTML( $out ); |
132 | 150 | } |
— | — | @@ -133,7 +151,7 @@ |
134 | 152 | function tryCreateSubmit( $formData, $entryPoint = 'internal' ) { |
135 | 153 | global $wgOut, $wgUser; |
136 | 154 | |
137 | | - $success = OpenStackNovaDomain::createDomain( $formData['domainname'], $formData['fqdn'] ); |
| 155 | + $success = OpenStackNovaDomain::createDomain( $formData['domainname'], $formData['fqdn'], $formData['location'] ); |
138 | 156 | if ( ! $success ) { |
139 | 157 | $out = Html::element( 'p', array(), 'Failed to create domain' ); |
140 | 158 | $wgOut->addHTML( $out ); |
Index: trunk/extensions/OpenStackManager/OpenStackManager.i18n.php |
— | — | @@ -39,17 +39,23 @@ |
40 | 40 | 'openstackmanager' => 'Successfully deleted domain', |
41 | 41 | 'openstackmanager' => 'Failed to delete domain', |
42 | 42 | |
43 | | - 'openstackmanager' => 'Create Instance', |
| 43 | + 'openstackmanager-createinstance' => 'Create Instance', |
| 44 | + 'openstackmanager-novainstance-instance' => 'Instance', |
44 | 45 | 'openstackmanager' => 'Configure Instance', |
45 | 46 | 'openstackmanager' => 'The host requested does not exist.', |
| 47 | + 'openstackmanager-dnsdomain' => 'DNS Domain', |
| 48 | + 'openstackmanager-puppetclasses' => 'Puppet Classes', |
| 49 | + 'openstackmanager-novainstance-info' => 'Instance Information', |
| 50 | + 'openstackmanager-novainstance-puppetinfo' => 'Puppet Information', |
46 | 51 | |
47 | 52 | 'openstackmanager' => 'Are you sure you wish to delete instance "$1"?', |
48 | 53 | 'openstackmanager' => 'Instance list', |
49 | | - 'openstackmanager' => 'Instance Name', |
| 54 | + 'openstackmanager-instancename' => 'Instance Name', |
50 | 55 | 'openstackmanager' => 'Instance ID', |
51 | 56 | 'openstackmanager' => 'Instance State', |
52 | | - 'openstackmanager' => 'Instance Type', |
53 | | - 'openstackmanager' => 'Image ID', |
| 57 | + 'openstackmanager-instancetype' => 'Instance Type', |
| 58 | + 'openstackmanager-availabilityzone' => 'Availability Zone', |
| 59 | + 'openstackmanager-imagetype' => 'Image Type', |
54 | 60 | 'openstackmanager' => 'Actions', |
55 | 61 | |
56 | 62 | 'openstackmanager' => 'Create a new instance', |
— | — | @@ -97,5 +103,6 @@ |
98 | 104 | 'openstackmanager' => 'Failed to delete project', |
99 | 105 | 'openstackmanager' => 'Successfully added $1 to $2', |
100 | 106 | 'openstackmanager' => 'Failed to add $1 to $2', |
| 107 | + 'openstackmanager-badinstancename' => 'Bad instance name provided. Instance names must start with a-z, and can only contain a-z, 0-9, and - characters.', |
101 | 108 | |
102 | 109 | ); |
Index: trunk/extensions/OpenStackManager/OpenStackNovaProject.php |
— | — | @@ -15,8 +15,9 @@ |
16 | 16 | function connect() { |
17 | 17 | global $wgAuth; |
18 | 18 | global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword; |
| 19 | + global $wgOpenStackManagerLDAPDomain; |
19 | 20 | |
20 | | - $wgAuth->connect(); |
| 21 | + $wgAuth->connect( $wgOpenStackManagerLDAPDomain ); |
21 | 22 | $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword ); |
22 | 23 | } |
23 | 24 | |
— | — | @@ -120,8 +121,9 @@ |
121 | 122 | global $wgAuth; |
122 | 123 | global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword; |
123 | 124 | global $wgOpenStackManagerLDAPProjectBaseDN; |
| 125 | + global $wgOpenStackManagerLDAPDomain; |
124 | 126 | |
125 | | - $wgAuth->connect(); |
| 127 | + $wgAuth->connect( $wgOpenStackManagerLDAPDomain ); |
126 | 128 | $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword ); |
127 | 129 | |
128 | 130 | $projects = array(); |
— | — | @@ -149,8 +151,9 @@ |
150 | 152 | global $wgAuth; |
151 | 153 | global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword; |
152 | 154 | global $wgOpenStackManagerLDAPProjectBaseDN; |
| 155 | + global $wgOpenStackManagerLDAPDomain; |
153 | 156 | |
154 | | - $wgAuth->connect(); |
| 157 | + $wgAuth->connect( $wgOpenStackManagerLDAPDomain ); |
155 | 158 | $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword ); |
156 | 159 | |
157 | 160 | $project['objectclass'][] = 'groupofnames'; |
— | — | @@ -175,9 +178,10 @@ |
176 | 179 | static function deleteProject( $projectname ) { |
177 | 180 | global $wgAuth; |
178 | 181 | global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword; |
| 182 | + global $wgOpenStackManagerLDAPDomain; |
179 | 183 | |
180 | 184 | |
181 | | - $wgAuth->connect(); |
| 185 | + $wgAuth->connect( $wgOpenStackManagerLDAPDomain ); |
182 | 186 | $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword ); |
183 | 187 | |
184 | 188 | $project = new OpenStackNovaProject( $projectname ); |
— | — | @@ -210,6 +214,7 @@ |
211 | 215 | global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword; |
212 | 216 | global $wgOpenStackManagerLDAPDomain; |
213 | 217 | global $wgExtraNamespaces; |
| 218 | + global $wgOpenStackManagerLDAPDomain; |
214 | 219 | |
215 | 220 | $wgAuth->connect( $wgOpenStackManagerLDAPDomain ); |
216 | 221 | $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword ); |
Index: trunk/extensions/OpenStackManager/OpenStackNovaDomain.php |
— | — | @@ -16,8 +16,9 @@ |
17 | 17 | function connect() { |
18 | 18 | global $wgAuth; |
19 | 19 | global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword; |
| 20 | + global $wgOpenStackManagerLDAPDomain; |
20 | 21 | |
21 | | - $wgAuth->connect(); |
| 22 | + $wgAuth->connect( $wgOpenStackManagerLDAPDomain ); |
22 | 23 | $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword ); |
23 | 24 | } |
24 | 25 | |
— | — | @@ -44,6 +45,14 @@ |
45 | 46 | return $this->fqdn; |
46 | 47 | } |
47 | 48 | |
| 49 | + function getLocation() { |
| 50 | + if ( isset( $this->domainInfo[0]['l'] ) ) { |
| 51 | + return $this->domainInfo[0]['l'][0]; |
| 52 | + } else { |
| 53 | + return ''; |
| 54 | + } |
| 55 | + } |
| 56 | + |
48 | 57 | function updateSOA() { |
49 | 58 | global $wgAuth; |
50 | 59 | |
— | — | @@ -60,15 +69,21 @@ |
61 | 70 | } |
62 | 71 | } |
63 | 72 | |
64 | | - static function getAllDomains() { |
| 73 | + static function getAllDomains( $bylocation=false) { |
65 | 74 | global $wgAuth; |
66 | 75 | global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword; |
67 | 76 | global $wgOpenStackManagerLDAPInstanceBaseDN; |
| 77 | + global $wgOpenStackManagerLDAPDomain; |
68 | 78 | |
69 | | - $wgAuth->connect(); |
| 79 | + $wgAuth->connect( $wgOpenStackManagerLDAPDomain ); |
70 | 80 | $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword ); |
71 | 81 | |
72 | 82 | $domains = array(); |
| 83 | + if ( $bylocation ) { |
| 84 | + $query = '(&(soarecord=*)(l=*))'; |
| 85 | + } else { |
| 86 | + $query = '(soarecord=*)'; |
| 87 | + } |
73 | 88 | wfSuppressWarnings(); |
74 | 89 | $result = ldap_search( $wgAuth->ldapconn, $wgOpenStackManagerLDAPInstanceBaseDN, '(soarecord=*)' ); |
75 | 90 | wfRestoreWarnings(); |
— | — | @@ -102,8 +117,9 @@ |
103 | 118 | global $wgAuth; |
104 | 119 | global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword; |
105 | 120 | global $wgOpenStackManagerLDAPInstanceBaseDN; |
| 121 | + global $wgOpenStackManagerLDAPDomain; |
106 | 122 | |
107 | | - $wgAuth->connect(); |
| 123 | + $wgAuth->connect( $wgOpenStackManagerLDAPDomain ); |
108 | 124 | $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword ); |
109 | 125 | |
110 | 126 | wfSuppressWarnings(); |
— | — | @@ -126,8 +142,9 @@ |
127 | 143 | global $wgAuth; |
128 | 144 | global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword; |
129 | 145 | global $wgOpenStackManagerLDAPInstanceBaseDN; |
| 146 | + global $wgOpenStackManagerLDAPDomain; |
130 | 147 | |
131 | | - $wgAuth->connect(); |
| 148 | + $wgAuth->connect( $wgOpenStackManagerLDAPDomain ); |
132 | 149 | $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword ); |
133 | 150 | |
134 | 151 | wfSuppressWarnings(); |
— | — | @@ -147,13 +164,14 @@ |
148 | 165 | } |
149 | 166 | |
150 | 167 | # TODO: Allow generic domains; get rid of config set base name |
151 | | - static function createDomain( $domainname, $fqdn ) { |
| 168 | + static function createDomain( $domainname, $fqdn, $location ) { |
152 | 169 | global $wgAuth; |
153 | 170 | global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword; |
154 | 171 | global $wgOpenStackManagerLDAPInstanceBaseDN; |
155 | | - global $wgOpenStackManagerDNSServers; |
| 172 | + global $wgOpenStackManagerDNSOptions; |
| 173 | + global $wgOpenStackManagerLDAPDomain; |
156 | 174 | |
157 | | - $wgAuth->connect(); |
| 175 | + $wgAuth->connect( $wgOpenStackManagerLDAPDomain ); |
158 | 176 | $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword ); |
159 | 177 | |
160 | 178 | $soa = OpenStackNovaDomain::generateSOA(); |
— | — | @@ -161,8 +179,9 @@ |
162 | 180 | $domain['objectclass'][] = 'dnsdomain'; |
163 | 181 | $domain['objectclass'][] = 'domainrelatedobject'; |
164 | 182 | $domain['dc'] = $domainname; |
165 | | - $domain['soarecord'] = $wgOpenStackManagerDNSServers['primary'] . ' ' . $soa; |
| 183 | + $domain['soarecord'] = $wgOpenStackManagerDNSOptions['servers']['primary'] . ' ' . $soa; |
166 | 184 | $domain['associateddomain'] = $fqdn; |
| 185 | + $domain['l'] = $location; |
167 | 186 | $dn = 'dc=' . $domainname . ',' . $wgOpenStackManagerLDAPInstanceBaseDN; |
168 | 187 | |
169 | 188 | wfSuppressWarnings(); |
— | — | @@ -180,8 +199,9 @@ |
181 | 200 | static function deleteDomain( $domainname ) { |
182 | 201 | global $wgAuth; |
183 | 202 | global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword; |
| 203 | + global $wgOpenStackManagerLDAPDomain; |
184 | 204 | |
185 | | - $wgAuth->connect(); |
| 205 | + $wgAuth->connect( $wgOpenStackManagerLDAPDomain ); |
186 | 206 | $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword ); |
187 | 207 | |
188 | 208 | $domain = new OpenStackNovaDomain( $domainname ); |
— | — | @@ -211,12 +231,14 @@ |
212 | 232 | } |
213 | 233 | |
214 | 234 | static function generateSOA() { |
215 | | - global $wgOpenStackManagerDNSSOA; |
| 235 | + global $wgOpenStackManagerDNSOptions; |
216 | 236 | |
217 | 237 | $serial = date( 'YmdHis' ); |
218 | | - $soa = $wgOpenStackManagerDNSSOA['hostmaster'] . ' ' . $serial . ' ' . |
219 | | - $wgOpenStackManagerDNSSOA['refresh'] . ' ' . $wgOpenStackManagerDNSSOA['retry'] . ' ' . |
220 | | - $wgOpenStackManagerDNSSOA['expiry'] . ' ' . $wgOpenStackManagerDNSSOA['minimum']; |
| 238 | + $soa = $wgOpenStackManagerDNSOptions['soa']['hostmaster'] . ' ' . $serial . ' ' . |
| 239 | + $wgOpenStackManagerDNSOptions['soa']['refresh'] . ' ' . |
| 240 | + $wgOpenStackManagerDNSOptions['soa']['retry'] . ' ' . |
| 241 | + $wgOpenStackManagerDNSOptions['soa']['expiry'] . ' ' . |
| 242 | + $wgOpenStackManagerDNSOptions['soa']['minimum']; |
221 | 243 | |
222 | 244 | return $soa; |
223 | 245 | } |
Index: trunk/extensions/OpenStackManager/OpenStackNovaHostJob.php |
— | — | @@ -0,0 +1,46 @@ |
| 2 | +<?php |
| 3 | +class OpenStackNovaHostJob extends Job { |
| 4 | + public function __construct( $title, $params ) { |
| 5 | + // Replace synchroniseThreadArticleData with the an identifier for your job. |
| 6 | + parent::__construct( 'addDNSHostToLDAP', $title, $params ); |
| 7 | + } |
| 8 | + |
| 9 | + /** |
| 10 | + * Execute the job |
| 11 | + * |
| 12 | + * @return bool |
| 13 | + */ |
| 14 | + public function run() { |
| 15 | + global $wgOpenStackManagerNovaAdminKeys; |
| 16 | + global $wgAuth; |
| 17 | + |
| 18 | + $instanceid = $this->params['instanceid']; |
| 19 | + $wgAuth->printDebug( "Running DNS job for $instanceid", NONSENSITIVE ); |
| 20 | + |
| 21 | + $adminCredentials = $wgOpenStackManagerNovaAdminKeys; |
| 22 | + $adminNova = new OpenStackNovaController( $adminCredentials ); |
| 23 | + $instance = $adminNova->getInstance( $instanceid ); |
| 24 | + if ( ! $instance ) { |
| 25 | + $wgAuth->printDebug( "Instance doesn't exist for $instanceid", NONSENSITIVE ); |
| 26 | + # Instance no longer exists |
| 27 | + return true; |
| 28 | + } |
| 29 | + $ip = (string)$instance->getInstancePrivateIP(); |
| 30 | + if ( trim( $ip ) == '' ) { |
| 31 | + # IP hasn't been assigned yet |
| 32 | + # re-add to queue |
| 33 | + $wgAuth->printDebug( "Readding job for $instanceid", NONSENSITIVE ); |
| 34 | + $job = new OpenStackNovaHostJob( $this->title, $this->params ); |
| 35 | + $job->insert(); |
| 36 | + return true; |
| 37 | + } |
| 38 | + $host = OpenStackNovaHost::getHostByInstanceId( $instanceid ); |
| 39 | + if ( ! $host ) { |
| 40 | + $wgAuth->printDebug( "Host record doesn't exist for $instanceid", NONSENSITIVE ); |
| 41 | + return true; |
| 42 | + } |
| 43 | + $host->setARecord( $ip ); |
| 44 | + |
| 45 | + return true; |
| 46 | + } |
| 47 | +} |
Property changes on: trunk/extensions/OpenStackManager/OpenStackNovaHostJob.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 48 | + native |
Index: trunk/extensions/OpenStackManager/OpenStackNovaHost.php |
— | — | @@ -17,8 +17,9 @@ |
18 | 18 | function connect() { |
19 | 19 | global $wgAuth; |
20 | 20 | global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword; |
| 21 | + global $wgOpenStackManagerLDAPDomain; |
21 | 22 | |
22 | | - $wgAuth->connect(); |
| 23 | + $wgAuth->connect( $wgOpenStackManagerLDAPDomain ); |
23 | 24 | $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword ); |
24 | 25 | } |
25 | 26 | |
— | — | @@ -47,7 +48,7 @@ |
48 | 49 | } |
49 | 50 | |
50 | 51 | function getFullyQualifiedHostName() { |
51 | | - return $this->getHostName() . '.' . $this->domain->getFullyQualifiedDomainName(); |
| 52 | + return $this->getHostName(); |
52 | 53 | } |
53 | 54 | |
54 | 55 | function getPuppetConfiguration() { |
— | — | @@ -181,6 +182,23 @@ |
182 | 183 | } |
183 | 184 | } |
184 | 185 | |
| 186 | + function setARecord( $ip ) { |
| 187 | + global $wgAuth; |
| 188 | + |
| 189 | + $values = array( 'arecord' => array( $ip ) ); |
| 190 | + wfSuppressWarnings(); |
| 191 | + $success = ldap_modify( $wgAuth->ldapconn, $this->hostDN, $values ); |
| 192 | + wfRestoreWarnings(); |
| 193 | + if ( $success ) { |
| 194 | + $wgAuth->printDebug( "Successfully set $ip on $this->hostDN", NONSENSITIVE ); |
| 195 | + $this->domain->updateSOA(); |
| 196 | + return true; |
| 197 | + } else { |
| 198 | + $wgAuth->printDebug( "Failed to set $ip on $this->hostDN", NONSENSITIVE ); |
| 199 | + return false; |
| 200 | + } |
| 201 | + } |
| 202 | + |
185 | 203 | static function getHostByName( $hostname, $domain ) { |
186 | 204 | $host = new OpenStackNovaHost( $hostname, $domain ); |
187 | 205 | if ( $host->hostInfo ) { |
— | — | @@ -198,8 +216,9 @@ |
199 | 217 | static function getAllHosts( $domain ) { |
200 | 218 | global $wgAuth; |
201 | 219 | global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword; |
| 220 | + global $wgOpenStackManagerLDAPDomain; |
202 | 221 | |
203 | | - $wgAuth->connect(); |
| 222 | + $wgAuth->connect( $wgOpenStackManagerLDAPDomain ); |
204 | 223 | $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword ); |
205 | 224 | |
206 | 225 | $hosts = array(); |
— | — | @@ -225,8 +244,9 @@ |
226 | 245 | static function deleteHost( $hostname, $domain ) { |
227 | 246 | global $wgAuth; |
228 | 247 | global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword; |
| 248 | + global $wgOpenStackManagerLDAPDomain; |
229 | 249 | |
230 | | - $wgAuth->connect(); |
| 250 | + $wgAuth->connect( $wgOpenStackManagerLDAPDomain ); |
231 | 251 | $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword ); |
232 | 252 | |
233 | 253 | $host = OpenStackNovaHost::getHostByName( $hostname, $domain ); |
— | — | @@ -252,8 +272,9 @@ |
253 | 273 | static function deleteHostByInstanceId( $instanceid ) { |
254 | 274 | global $wgAuth; |
255 | 275 | global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword; |
| 276 | + global $wgOpenStackManagerLDAPDomain; |
256 | 277 | |
257 | | - $wgAuth->connect(); |
| 278 | + $wgAuth->connect( $wgOpenStackManagerLDAPDomain ); |
258 | 279 | $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword ); |
259 | 280 | |
260 | 281 | $host = OpenStackNovaHost::getHostByInstanceId( $instanceid ); |
— | — | @@ -289,8 +310,9 @@ |
290 | 311 | global $wgAuth; |
291 | 312 | global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword; |
292 | 313 | global $wgOpenStackManagerLDAPInstanceBaseDN, $wgOpenStackManagerPuppetOptions; |
| 314 | + global $wgOpenStackManagerLDAPDomain; |
293 | 315 | |
294 | | - $wgAuth->connect(); |
| 316 | + $wgAuth->connect( $wgOpenStackManagerLDAPDomain ); |
295 | 317 | $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword ); |
296 | 318 | |
297 | 319 | $hostname = $instance->getInstanceName(); |
— | — | @@ -324,7 +346,9 @@ |
325 | 347 | $hostEntry['puppetclass'][] = $class; |
326 | 348 | } |
327 | 349 | foreach( $puppetinfo['variables'] as $variable => $value ) { |
328 | | - $hostEntry['puppetvar'][] = $variable . ' = ' . $value; |
| 350 | + if ( $value ) { |
| 351 | + $hostEntry['puppetvar'][] = $variable . ' = ' . $value; |
| 352 | + } |
329 | 353 | } |
330 | 354 | } |
331 | 355 | } |
Index: trunk/extensions/OpenStackManager/OpenStackNovaUser.php |
— | — | @@ -148,8 +148,9 @@ |
149 | 149 | function connect() { |
150 | 150 | global $wgAuth; |
151 | 151 | global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword; |
| 152 | + global $wgOpenStackManagerLDAPDomain; |
152 | 153 | |
153 | | - $wgAuth->connect(); |
| 154 | + $wgAuth->connect( $wgOpenStackManagerLDAPDomain ); |
154 | 155 | $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword ); |
155 | 156 | } |
156 | 157 | |
Index: trunk/extensions/OpenStackManager/OpenStackNovaController.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | var $novaConnection; |
8 | 8 | var $instances, $images, $keypairs, $availabilityZones; |
9 | 9 | |
10 | | - var $instanceTypes = array( 't1.micro', 'm1.small', 'm1.large', 'm1.xlarge', 'm2.xlarge', 'm2.2xlarge', |
| 10 | + var $instanceTypes = array( 'm1.small', 'm1.large', 'm1.xlarge', 'm2.xlarge', 'm2.2xlarge', |
11 | 11 | 'm2.4xlarge', 'c1.medium', 'c1.xlarge', 'cc1.4xlarge' ); |
12 | 12 | |
13 | 13 | # TODO: Make disable_ssl, hostname, and resource_prefix config options |
— | — | @@ -21,28 +21,23 @@ |
22 | 22 | $this->instances = array(); |
23 | 23 | } |
24 | 24 | |
25 | | - function getInstance( $instanceId, $reload = false ) { |
26 | | - if ( isset( $this->instances[$instanceId] ) && !$reload ) { |
27 | | - $instance = $this->instances[$instanceId]; |
| 25 | + function getInstance( $instanceId ) { |
| 26 | + $this->getInstances(); |
| 27 | + if ( isset( $this->instances["$instanceId"] ) ) { |
| 28 | + return $this->instances["$instanceId"]; |
28 | 29 | } else { |
29 | | - $response = $this->novaConnection->describe_instances( $instanceId ); |
30 | | - $instance = new OpenStackNovaInstance( $response->body->reservationSet->item, true ); |
31 | | - $instanceId = $instance->getInstanceId(); |
32 | | - $this->instances["$instanceId"] = $instance; |
| 30 | + return null; |
33 | 31 | } |
34 | | - return $instance; |
35 | 32 | } |
36 | 33 | |
37 | | - function getInstances( $reload = false ) { |
38 | | - if ( count( $this->instances ) == 0 || $reload ) { |
39 | | - $this->instances = array(); |
40 | | - $response = $this->novaConnection->describe_instances(); |
41 | | - $instances = $response->body->reservationSet->item; |
42 | | - foreach ( $instances as $instance ) { |
43 | | - $instance = new OpenStackNovaInstance( $instance, true ); |
44 | | - $instanceId = $instance->getInstanceId(); |
45 | | - $this->instances["$instanceId"] = $instance; |
46 | | - } |
| 34 | + function getInstances() { |
| 35 | + $this->instances = array(); |
| 36 | + $response = $this->novaConnection->describe_instances(); |
| 37 | + $instances = $response->body->reservationSet->item; |
| 38 | + foreach ( $instances as $instance ) { |
| 39 | + $instance = new OpenStackNovaInstance( $instance, true ); |
| 40 | + $instanceId = $instance->getInstanceId(); |
| 41 | + $this->instances["$instanceId"] = $instance; |
47 | 42 | } |
48 | 43 | return $this->instances; |
49 | 44 | } |
— | — | @@ -51,44 +46,38 @@ |
52 | 47 | return $this->instanceTypes; |
53 | 48 | } |
54 | 49 | |
55 | | - function getImages( $reload = false ) { |
56 | | - if ( count( $this->images ) == 0 || $reload ) { |
57 | | - $this->images = array(); |
58 | | - $images = $this->novaConnection->describe_images(); |
59 | | - $images = $images->body->imagesSet->item; |
60 | | - foreach ( $images as $image ) { |
61 | | - if ( $image->imageType == 'machine' ) { |
62 | | - $this->images["$image->imageId"] = $image; |
63 | | - } |
| 50 | + function getImages() { |
| 51 | + $this->images = array(); |
| 52 | + $images = $this->novaConnection->describe_images(); |
| 53 | + $images = $images->body->imagesSet->item; |
| 54 | + foreach ( $images as $image ) { |
| 55 | + if ( $image->imageType == 'machine' ) { |
| 56 | + $this->images["$image->imageId"] = $image; |
64 | 57 | } |
65 | 58 | } |
66 | 59 | return $this->images; |
67 | 60 | } |
68 | 61 | |
69 | 62 | # TODO: make this user specific |
70 | | - function getKeypairs( $reload = false ) { |
71 | | - if ( count( $this->keypairs ) == 0 || $reload ) { |
72 | | - $this->keypairs = array(); |
73 | | - $response = $this->novaConnection->describe_key_pairs(); |
74 | | - $keypairs = $response->body->keypairsSet->item; |
75 | | - foreach ( $keypairs as $keypair ) { |
76 | | - $keypair = new OpenStackNovaKeypair( $keypair ); |
77 | | - $keyname = $keypair->getKeyName(); |
78 | | - $this->keypairs["$keyname"] = $keypair; |
79 | | - } |
| 63 | + function getKeypairs() { |
| 64 | + $this->keypairs = array(); |
| 65 | + $response = $this->novaConnection->describe_key_pairs(); |
| 66 | + $keypairs = $response->body->keypairsSet->item; |
| 67 | + foreach ( $keypairs as $keypair ) { |
| 68 | + $keypair = new OpenStackNovaKeypair( $keypair ); |
| 69 | + $keyname = $keypair->getKeyName(); |
| 70 | + $this->keypairs["$keyname"] = $keypair; |
80 | 71 | } |
81 | 72 | return $this->keypairs; |
82 | 73 | } |
83 | 74 | |
84 | | - function getAvailabilityZones( $reload = false ) { |
85 | | - if ( count( $this->availabilityZones ) == 0 || $reload ) { |
86 | | - $this->availabilityZones = array(); |
87 | | - $availabilityZones = $this->novaConnection->describe_availability_zones(); |
88 | | - $availabilityZones = $availabilityZones->body->availabilityZoneInfo->item; |
89 | | - foreach ( $availabilityZones as $availabilityZone ) { |
90 | | - if ( $availabilityZones->zoneState == "available" ) { |
91 | | - $this->availabilityZones["$availabilityZones->zoneName"] = $availabilityZone; |
92 | | - } |
| 75 | + function getAvailabilityZones() { |
| 76 | + $this->availabilityZones = array(); |
| 77 | + $availabilityZones = $this->novaConnection->describe_availability_zones(); |
| 78 | + $availabilityZones = $availabilityZones->body->availabilityZoneInfo->item; |
| 79 | + foreach ( $availabilityZones as $availabilityZone ) { |
| 80 | + if ( $availabilityZones->zoneState == "available" ) { |
| 81 | + $this->availabilityZones["$availabilityZones->zoneName"] = $availabilityZone; |
93 | 82 | } |
94 | 83 | } |
95 | 84 | return $this->availabilityZones; |
Index: trunk/extensions/OpenStackManager/OpenStackManager.php |
— | — | @@ -67,6 +67,7 @@ |
68 | 68 | $wgAutoloadClasses['SpecialNovaProject'] = $dir . 'SpecialNovaProject.php'; |
69 | 69 | $wgAutoloadClasses['SpecialNovaDomain'] = $dir . 'SpecialNovaDomain.php'; |
70 | 70 | $wgAutoloadClasses['SpecialNova'] = $dir . 'SpecialNova.php'; |
| 71 | +$wgAutoloadClasses['OpenStackNovaHostJob'] = $dir . 'OpenStackNovaHostJob.php'; |
71 | 72 | $wgAutoloadClasses['AmazonEC2'] = $dir . 'aws-sdk/sdk.class.php'; |
72 | 73 | $wgSpecialPages['NovaInstance'] = 'SpecialNovaInstance'; |
73 | 74 | $wgSpecialPageGroups['NovaInstance'] = 'other'; |
— | — | @@ -76,6 +77,7 @@ |
77 | 78 | $wgSpecialPageGroups['NovaProject'] = 'other'; |
78 | 79 | $wgSpecialPages['NovaDomain'] = 'SpecialNovaDomain'; |
79 | 80 | $wgSpecialPageGroups['NovaDomain'] = 'other'; |
| 81 | +$wgJobClasses['addDNSHostToLDAP'] = 'OpenStackNovaHostJob'; |
80 | 82 | |
81 | 83 | $wgHooks['LDAPSetCreationValues'][] = 'OpenStackNovaUser::LDAPSetCreationValues'; |
82 | 84 | $wgHooks['LDAPModifyUITemplate'][] = 'OpenStackNovaUser::LDAPModifyUITemplate'; |