Index: trunk/extensions/OpenStackManager/SpecialNovaInstance.php |
— | — | @@ -147,27 +147,29 @@ |
148 | 148 | 'default' => $wgRequest->getText( 'project' ), |
149 | 149 | ); |
150 | 150 | |
151 | | - if ( isset( $wgOpenStackManagerPuppetOptions['availableclasses'] ) ) { |
152 | | - $classes = array(); |
153 | | - foreach ( $wgOpenStackManagerPuppetOptions['availableclasses'] as $class ) { |
154 | | - $classes["$class"] = $class; |
155 | | - } |
156 | | - $instanceInfo['puppetclasses'] = array( |
157 | | - 'type' => 'multiselect', |
158 | | - 'section' => 'instance/puppetinfo', |
159 | | - 'options' => $classes, |
160 | | - 'label-message' => 'puppetclasses', |
161 | | - ); |
162 | | - } |
163 | | - |
164 | | - if ( isset( $wgOpenStackManagerPuppetOptions['availablevariables'] ) ) { |
165 | | - foreach ( $wgOpenStackManagerPuppetOptions['availablevariables'] as $variable ) { |
166 | | - $instanceInfo["$variable"] = array( |
167 | | - 'type' => 'text', |
| 151 | + if ( $wgOpenStackManagerPuppetOptions['enabled'] ) { |
| 152 | + if ( $wgOpenStackManagerPuppetOptions['availableclasses'] ) { |
| 153 | + $classes = array(); |
| 154 | + foreach ( $wgOpenStackManagerPuppetOptions['availableclasses'] as $class ) { |
| 155 | + $classes["$class"] = $class; |
| 156 | + } |
| 157 | + $instanceInfo['puppetclasses'] = array( |
| 158 | + 'type' => 'multiselect', |
168 | 159 | 'section' => 'instance/puppetinfo', |
169 | | - 'label' => $variable, |
| 160 | + 'options' => $classes, |
| 161 | + 'label-message' => 'puppetclasses', |
170 | 162 | ); |
171 | 163 | } |
| 164 | + |
| 165 | + if ( $wgOpenStackManagerPuppetOptions['availablevariables'] ) { |
| 166 | + foreach ( $wgOpenStackManagerPuppetOptions['availablevariables'] as $variable ) { |
| 167 | + $instanceInfo["$variable"] = array( |
| 168 | + 'type' => 'text', |
| 169 | + 'section' => 'instance/puppetinfo', |
| 170 | + 'label' => $variable, |
| 171 | + ); |
| 172 | + } |
| 173 | + } |
172 | 174 | } |
173 | 175 | |
174 | 176 | $instanceInfo['action'] = array( |
— | — | @@ -298,14 +300,12 @@ |
299 | 301 | $instance = $this->userNova->createInstance( $formData['instancename'], $formData['imageType'], '', $formData['instanceType'], $formData['availabilityZone'] ); |
300 | 302 | if ( $instance ) { |
301 | 303 | $puppetinfo = array(); |
302 | | - if ( isset( $wgOpenStackManagerPuppetOptions['availableclasses'] ) ) { |
| 304 | + if ( $wgOpenStackManagerPuppetOptions['enabled'] ) { |
303 | 305 | foreach ( $formData['puppetclasses'] as $class ) { |
304 | 306 | if ( in_array( $class, $wgOpenStackManagerPuppetOptions['availableclasses'] ) ) { |
305 | 307 | $puppetinfo['classes'][] = $class; |
306 | 308 | } |
307 | 309 | } |
308 | | - } |
309 | | - if ( isset( $wgOpenStackManagerPuppetOptions['availablevariables'] ) ) { |
310 | 310 | foreach ( $wgOpenStackManagerPuppetOptions['availablevariables'] as $variable ) { |
311 | 311 | if ( isset ( $formData["$variable"] ) ) { |
312 | 312 | $puppetinfo['variables']["$variable"] = $formData["$variable"]; |
Index: trunk/extensions/OpenStackManager/OpenStackNovaHost.php |
— | — | @@ -255,17 +255,13 @@ |
256 | 256 | $hostEntry['arecord'] = $ip; |
257 | 257 | $hostEntry['associateddomain'][] = $hostname . '.' . $domainname; |
258 | 258 | $hostEntry['cnamerecord'][] = $instanceid . '.' . $domainname; |
259 | | - if ( $wgOpenStackManagerPuppetOptions ) { |
| 259 | + if ( $wgOpenStackManagerPuppetOptions['enabled'] ) { |
260 | 260 | $hostEntry['objectclass'][] = 'puppetclient'; |
261 | | - if ( isset( $wgOpenStackManagerPuppetOptions['defaultclasses'] ) ) { |
262 | | - foreach ( $wgOpenStackManagerPuppetOptions['defaultclasses'] as $class ) { |
263 | | - $hostEntry['puppetclass'][] = $class; |
264 | | - } |
| 261 | + foreach ( $wgOpenStackManagerPuppetOptions['defaultclasses'] as $class ) { |
| 262 | + $hostEntry['puppetclass'][] = $class; |
265 | 263 | } |
266 | | - if ( isset( $wgOpenStackManagerPuppetOptions['defaultvariables'] ) ) { |
267 | | - foreach ( $wgOpenStackManagerPuppetOptions['defaultvariables'] as $variable => $value ) { |
268 | | - $hostEntry['puppetvar'][] = $variable . ' = ' . $value; |
269 | | - } |
| 264 | + foreach ( $wgOpenStackManagerPuppetOptions['defaultvariables'] as $variable => $value ) { |
| 265 | + $hostEntry['puppetvar'][] = $variable . ' = ' . $value; |
270 | 266 | } |
271 | 267 | if ( $puppetinfo ) { |
272 | 268 | foreach( $puppetinfo['classes'] as $class ) { |
Index: trunk/extensions/OpenStackManager/OpenStackNovaUser.php |
— | — | @@ -280,12 +280,12 @@ |
281 | 281 | $values['accesskey'] = OpenStackNovaUser::uuid4(); |
282 | 282 | $values['secretkey'] = OpenStackNovaUser::uuid4(); |
283 | 283 | $values['isadmin'] = 'FALSE'; |
284 | | - $uid = OpenStackNovaUser::getNextIdNumber( $auth, 'uidnumber' ); |
285 | | - if ( ! $uid ) { |
| 284 | + $uidnumber = OpenStackNovaUser::getNextIdNumber( $auth, 'uidnumber' ); |
| 285 | + if ( ! $uidnumber ) { |
286 | 286 | $result = false; |
287 | 287 | return false; |
288 | 288 | } |
289 | | - $values['uidnumber'] = $uid; |
| 289 | + $values['uidnumber'] = $uidnumber; |
290 | 290 | $values['gidnumber'] = $wgOpenStackManagerLDAPDefaultGid; |
291 | 291 | $values['homedirectory'] = '/home/' . $username; |
292 | 292 | |
— | — | @@ -295,4 +295,11 @@ |
296 | 296 | return true; |
297 | 297 | } |
298 | 298 | |
| 299 | + static function LDAPModifyUITemplate( &$template ) { |
| 300 | + $input = array( 'msg' => 'shellaccountname', 'type' => 'text', 'name' => 'shellaccountname', 'value' => '', 'helptext' => 'shellaccountnamehelp' ); |
| 301 | + $template->set( 'extraInput', array( $input ) ); |
| 302 | + |
| 303 | + return true; |
| 304 | + } |
| 305 | + |
299 | 306 | } |
Index: trunk/extensions/OpenStackManager/OpenStackManager.php |
— | — | @@ -35,6 +35,22 @@ |
36 | 36 | $wgOpenStackManagerNovaPort = 8773; |
37 | 37 | $wgOpenStackManagerNovaResourcePrefix = '/services/Cloud/'; |
38 | 38 | $wgOpenStackManagerNovaAdminKeys = array( 'accessKey' => '', 'secretKey' => '' ); |
| 39 | +$wgOpenStackManagerNovaKeypairStorage = 'ldap'; |
| 40 | +$wgOpenStackManagerLDAPDomain = ''; |
| 41 | +$wgOpenStackManagerLDAPUser = ''; |
| 42 | +$wgOpenStackManagerLDAPUserPassword = ''; |
| 43 | +$wgOpenStackManagerLDAPProjectBaseDN = ''; |
| 44 | +$wgOpenStackManagerLDAPInstanceBaseDN = ''; |
| 45 | +$wgOpenStackManagerLDAPDefaultGid = '500'; |
| 46 | +$wgOpenStackManagerDNSServers = array( 'primary' => 'localhost', 'secondary' => 'localhost' ); |
| 47 | +$wgOpenStackManagerDNSSOA = array( 'hostmaster' => 'hostmaster@localhost.localdomain', 'refresh' => '1800', 'retry' => '3600', 'expiry' => '86400', 'minimum' => '7200' ); |
| 48 | +$wgOpenStackManagerPuppetOptions = array( |
| 49 | + 'enabled' => false, |
| 50 | + 'defaultclasses' => array(), |
| 51 | + 'defaultvariables' => array(), |
| 52 | + 'availableclasses' => array(), |
| 53 | + 'availablevariables' => array(), |
| 54 | + ); |
39 | 55 | |
40 | 56 | $dir = dirname(__FILE__) . '/'; |
41 | 57 | |
— | — | @@ -62,5 +78,6 @@ |
63 | 79 | $wgSpecialPageGroups['NovaDomain'] = 'other'; |
64 | 80 | |
65 | 81 | $wgHooks['LDAPSetCreationValues'][] = 'OpenStackNovaUser::LDAPSetCreationValues'; |
| 82 | +$wgHooks['LDAPModifyUITemplate'][] = 'OpenStackNovaUser::LDAPModifyUITemplate'; |
66 | 83 | |
67 | 84 | require_once( "$IP/extensions/OpenStackManager/OpenStackNovaProject.php" ); |