Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2018
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Puppet 0.87 KB | None | 0 0
  1. class nova::cell_v2::map_instances (
  2.   $cell_uuid    = undef,
  3.   $cell_name    = undef,
  4.   $extra_params = '',
  5. ) {
  6.  
  7.   include ::nova::deps
  8.   include ::nova::params
  9.  
  10.   if (!$cell_uuid and !$cell_name) {
  11.     fail('Either cell_uuid or cell_name must be provided')
  12.   }
  13.  
  14.   if ($cell_uuid) {
  15.     $cell_uuid_real = $cell_uuid
  16.   } else {
  17.     # NOTE(aschultz): This is what breaks if you have multiple cells with the
  18.     # same name. So that's why using cell_uuid is better.
  19.     $cell_uuid_real = "$(nova-manage cell_v2 list_cells | sed -e '1,3d' -e '\$d' | awk -F ' *| *' '\$2 == \"${cell_name}\" {print \$4}')"
  20.   }
  21.  
  22.   exec { 'nova-cell_v2-map_instances':
  23.     path        => ['/bin', '/usr/bin'],
  24.     command     => "nova-manage ${extra_params} cell_v2 map_instances --cell_uuid=${cell_uuid_real}",
  25.     user        => $::nova::params::nova_user,
  26.     refreshonly => true,
  27.   }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement