@@ -77,34 +77,41 @@ def setup_automate
7777 # * determine correct email
7878 # * create user with existing delivery.{pem,pub}
7979 create_user = [
80- "chef-server-ctl user-create" ,
81- "delivery" , # options.username.to_s.shellescape,
82- "Automate" , # options.first_name.to_s.shellescape,
83- "User" , # options.last_name.to_s.shellescape,
84- "[email protected] " , # options.email.to_s.shellescape, 85- passwords [ "chef_user" ] . shellescape , # options.password.to_s.shellescape
86- "-f /etc/delivery/delivery.pem" ,
87- ] . join ( " " )
80+ "chef-server-ctl" ,
81+ "user-create" ,
82+ "delivery" , # options.username,
83+ "Automate" , # options.first_name,
84+ "User" , # options.last_name,
85+ "[email protected] " , # options.email, 86+ passwords [ "chef_user" ] , # options.password
87+ "-f" , "/etc/delivery/delivery.pem" ,
88+ ] . shelljoin
8889 retry_command ( create_user , retries : 1 )
8990
9091 # create chef server org
9192 create_org = [
92- "chef-server-ctl org-create " ,
93- "delivery" , # options.organization.to_s.shellescape ,
94- "delivery" , # options.organization.to_s.shellescape ,
95- "-a" ,
96- "delivery" # options.username.to_s.shellescape
97- ] . join ( " " )
93+ "chef-server-ctl" ,
94+ "org-create" ,
95+ "delivery" , # options.organization,
96+ "delivery" , # options.organization ,
97+ "-a" , " delivery" # options.username
98+ ] . shelljoin
9899 retry_command ( create_org , retries : 1 )
99100
101+ # Try to wait for automate to come up before attempting to create the
102+ # automate enterprise. This has the added bonus of being able to log
103+ # the state of all the services while we wait.
104+ retry_command ( "delivery-ctl status" , retries : 60 , seconds : 2 ) # Wait up to two minutes.
105+
100106 # create automate enterprise
101107 create_ent = [
102- "delivery-ctl create-enterprise" ,
108+ "delivery-ctl" ,
109+ "create-enterprise" ,
103110 "default" , # enterprise name
104111 "--ssh-pub-key-file=/etc/delivery/builder.pub" , # builder public key
105- "--password=#{ passwords [ 'admin_user' ] . shellescape } " , # admin password
106- "--builder-password=#{ passwords [ 'builder_user' ] . shellescape } " # builder password
107- ] . join ( " " )
112+ "--password=#{ passwords [ 'admin_user' ] } " , # admin password
113+ "--builder-password=#{ passwords [ 'builder_user' ] } " # builder password
114+ ] . shelljoin
108115 retry_command ( create_ent , retries : 3 , seconds : 10 )
109116 end
110117
@@ -367,6 +374,7 @@ def retry_command(cmd, retries: 5, seconds: 2, env: {})
367374 retries . times do
368375 command = Mixlib ::ShellOut . new ( cmd )
369376 command . environment = env unless env . empty?
377+ command . live_stream = STDOUT if options . debug
370378 command . run_command
371379 return unless command . error?
372380 ui . say ( "#{ cmd } failed, retrying..." )
0 commit comments