File tree Expand file tree Collapse file tree 1 file changed +5
-31
lines changed
Expand file tree Collapse file tree 1 file changed +5
-31
lines changed Original file line number Diff line number Diff line change @@ -336,38 +336,12 @@ def _put_ssh_key(disk_id)
336336 end
337337
338338 def _copying_image
339- # SSH鍵はdisk/configで設定済み
340- # スタートアップスクリプトはcloud-initで実行
341- startup_script_path = './startup-scripts/112900928939'
339+ # 通常版UbuntuではSSH鍵とスタートアップスクリプトIDは
340+ # disk/config APIで既に設定済み(_put_ssh_keyメソッド内)
341+ # ここではサーバーを起動するだけでよい
342342
343- if File . exist? ( startup_script_path )
344- startup_script_content = File . read ( startup_script_path )
345-
346- # cloud-config(SSH鍵とスクリプト実行)
347- cloud_config = <<-EOF
348- #cloud-config
349- ssh_authorized_keys:
350- - #{ @pubkey }
351- runcmd:
352- - |
353- #{ startup_script_content . split ( "\n " ) . map { |line | line . strip . empty? ? "" : " #{ line } " } . join ( "\n " ) }
354- EOF
355-
356- puts "DEBUG: Starting server with cloud-init for startup script" if @verbose
357- puts "DEBUG: cloud-config (first 200 chars): #{ cloud_config [ 0 ..200 ] } ..." if @verbose
358-
359- body = {
360- UserBootVariables : {
361- CloudInit : {
362- UserData : cloud_config
363- }
364- }
365- }
366- send_request ( 'put' , "server/#{ @server_id } /power" , body )
367- else
368- puts "Warning: Startup script not found at #{ startup_script_path } "
369- send_request ( 'put' , "server/#{ @server_id } /power" , nil )
370- end
343+ puts "DEBUG: Starting server (SSH key and startup script already configured via disk/config API)" if @verbose
344+ send_request ( 'put' , "server/#{ @server_id } /power" , nil )
371345
372346 rescue => exception
373347 puts exception
You can’t perform that action at this time.
0 commit comments