Class: ForemanOmaha::ContainerLinuxConfigTranspiler
- Inherits:
-
Object
- Object
- ForemanOmaha::ContainerLinuxConfigTranspiler
- Defined in:
- app/services/foreman_omaha/container_linux_config_transpiler.rb
Defined Under Namespace
Classes: TranspileError, TranspilerNotFound
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#input ⇒ Object
Returns the value of attribute input.
-
#output ⇒ Object
Returns the value of attribute output.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #check_transpiler ⇒ Object
- #cmd ⇒ Object
-
#initialize(input) ⇒ ContainerLinuxConfigTranspiler
constructor
A new instance of ContainerLinuxConfigTranspiler.
- #run! ⇒ Object
- #transpile ⇒ Object
Constructor Details
#initialize(input) ⇒ ContainerLinuxConfigTranspiler
Returns a new instance of ContainerLinuxConfigTranspiler.
13 14 15 |
# File 'app/services/foreman_omaha/container_linux_config_transpiler.rb', line 13 def initialize(input) self.input = input end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
11 12 13 |
# File 'app/services/foreman_omaha/container_linux_config_transpiler.rb', line 11 def errors @errors end |
#input ⇒ Object
Returns the value of attribute input.
11 12 13 |
# File 'app/services/foreman_omaha/container_linux_config_transpiler.rb', line 11 def input @input end |
#output ⇒ Object
Returns the value of attribute output.
11 12 13 |
# File 'app/services/foreman_omaha/container_linux_config_transpiler.rb', line 11 def output @output end |
#status ⇒ Object
Returns the value of attribute status.
11 12 13 |
# File 'app/services/foreman_omaha/container_linux_config_transpiler.rb', line 11 def status @status end |
Instance Method Details
#check_transpiler ⇒ Object
29 30 31 |
# File 'app/services/foreman_omaha/container_linux_config_transpiler.rb', line 29 def check_transpiler raise TranspilerNotFound, 'The ct binary was not found in your PATH.' if cmd.blank? end |
#cmd ⇒ Object
33 34 35 |
# File 'app/services/foreman_omaha/container_linux_config_transpiler.rb', line 33 def cmd @cmd ||= Foreman::Util.which('ct') end |
#run! ⇒ Object
17 18 19 20 21 22 23 |
# File 'app/services/foreman_omaha/container_linux_config_transpiler.rb', line 17 def run! check_transpiler transpile raise TranspileError, "Could not transpile container linux config to ignition: #{errors}" unless status.success? output end |
#transpile ⇒ Object
25 26 27 |
# File 'app/services/foreman_omaha/container_linux_config_transpiler.rb', line 25 def transpile self.output, self.errors, self.status = Open3.capture3(cmd, :stdin_data => input) end |