Class: Kitchen::Provisioner::CincApply
- Inherits:
-
CincBase
- Object
- Base
- CincBase
- Kitchen::Provisioner::CincApply
show all
- Defined in:
- lib/kitchen/provisioner/cinc_apply.rb
Overview
Instance Method Summary
collapse
Methods inherited from CincBase
#initialize, #install_command
Instance Method Details
#create_sandbox ⇒ Object
75
76
77
78
79
80
81
82
83
|
# File 'lib/kitchen/provisioner/cinc_apply.rb', line 75
def create_sandbox
@sandbox_path = Dir.mktmpdir("#{instance.name}-sandbox-")
File.chmod(0755, sandbox_path)
info("Preparing files for transfer")
debug("Creating local sandbox in #{sandbox_path}")
prepare_json
prepare(:apply)
end
|
#init_command ⇒ Object
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/kitchen/provisioner/cinc_apply.rb', line 86
def init_command
dirs = %w{
apply
}.sort.map { |dir| remote_path_join(config[:root_path], dir) }
vars = if powershell_shell?
init_command_vars_for_powershell(dirs)
else
init_command_vars_for_bourne(dirs)
end
prefix_command(shell_code_from_file(vars, "cinc_base_init_command"))
end
|
#run_command ⇒ Object
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# File 'lib/kitchen/provisioner/cinc_apply.rb', line 101
def run_command
level = config[:log_level]
lines = []
config[:run_list].map do |recipe|
cmd = sudo(config[:cinc_apply_path]).dup
.tap { |str| str.insert(0, "& ") if powershell_shell? }
args = [
"apply/#{recipe}.rb",
"--log_level #{level}",
"--no-color",
]
args << "--logfile #{config[:log_file]}" if config[:log_file]
lines << wrap_shell_code(
[cmd, *args].join(" ")
.tap { |str| str.insert(0, reload_ps1_path) if windows_os? }
)
end
prefix_command(lines.join("\n"))
end
|