@@ -30,36 +30,36 @@ module ServerHelper
3030
3131 def create_server
3232 server_def = init_configuration
33- raise ( ActionFailed , ' Cannot specify both network_ref and network_id' ) if config [ :network_id ] && config [ :network_ref ]
33+ raise ( ActionFailed , " Cannot specify both network_ref and network_id" ) if config [ :network_id ] && config [ :network_ref ]
3434
3535 if config [ :network_id ]
3636 networks = [ ] . push ( config [ :network_id ] )
3737 server_def [ :nics ] = networks . flatten . map do |net_id |
38- { ' net_id' => net_id }
38+ { " net_id" => net_id }
3939 end
4040 elsif config [ :network_ref ]
4141 networks = [ ] . push ( config [ :network_ref ] )
4242 server_def [ :nics ] = networks . flatten . map do |net |
43- { ' net_id' => find_network ( net ) . id }
43+ { " net_id" => find_network ( net ) . id }
4444 end
4545 end
4646
4747 if config [ :block_device_mapping ]
4848 server_def [ :block_device_mapping ] = get_bdm ( config )
4949 end
5050
51- %i(
51+ %i{
5252 security_groups
5353 key_name
5454 user_data
5555 config_drive
5656 metadata
57- ) . each do |c |
57+ } . each do |c |
5858 server_def [ c ] = optional_config ( c ) if config [ c ]
5959 end
6060
6161 if config [ :cloud_config ]
62- raise ( ActionFailed , ' Cannot specify both cloud_config and user_data' ) if config [ :user_data ]
62+ raise ( ActionFailed , " Cannot specify both cloud_config and user_data" ) if config [ :user_data ]
6363
6464 server_def [ :user_data ] = YAML . dump ( Kitchen ::Util . stringified_hash ( config [ :cloud_config ] ) ) . gsub ( /^---\n / , "#cloud-config\n " )
6565 end
@@ -71,8 +71,8 @@ def create_server
7171 end
7272
7373 def init_configuration
74- raise ( ActionFailed , ' Cannot specify both image_ref and image_id' ) if config [ :image_id ] && config [ :image_ref ]
75- raise ( ActionFailed , ' Cannot specify both flavor_ref and flavor_id' ) if config [ :flavor_id ] && config [ :flavor_ref ]
74+ raise ( ActionFailed , " Cannot specify both image_ref and image_id" ) if config [ :image_id ] && config [ :image_ref ]
75+ raise ( ActionFailed , " Cannot specify both flavor_ref and flavor_id" ) if config [ :flavor_id ] && config [ :flavor_ref ]
7676
7777 {
7878 name : config [ :server_name ] ,
@@ -95,31 +95,31 @@ def optional_config(c)
9595
9696 def find_image ( image_ref )
9797 image = find_matching ( compute . images , image_ref )
98- raise ( ActionFailed , ' Image not found' ) unless image
98+ raise ( ActionFailed , " Image not found" ) unless image
9999
100100 debug "Selected image: #{ image . id } #{ image . name } "
101101 image
102102 end
103103
104104 def find_flavor ( flavor_ref )
105105 flavor = find_matching ( compute . flavors , flavor_ref )
106- raise ( ActionFailed , ' Flavor not found' ) unless flavor
106+ raise ( ActionFailed , " Flavor not found" ) unless flavor
107107
108108 debug "Selected flavor: #{ flavor . id } #{ flavor . name } "
109109 flavor
110110 end
111111
112112 def find_network ( network_ref )
113113 net = find_matching ( network . networks . all , network_ref )
114- raise ( ActionFailed , ' Network not found' ) unless net
114+ raise ( ActionFailed , " Network not found" ) unless net
115115
116116 debug "Selected net: #{ net . id } #{ net . name } "
117117 net
118118 end
119119
120120 def find_matching ( collection , name )
121121 name = name . to_s
122- if name . start_with? ( '/' ) && name . end_with? ( '/' )
122+ if name . start_with? ( "/" ) && name . end_with? ( "/" )
123123 regex = Regexp . new ( name [ 1 ...-1 ] )
124124 # check for regex name match
125125 collection . each { |single | return single if regex &.match? ( single . name ) }
0 commit comments