Class: HammerCLIForemanVirtWhoConfigure::VirtWhoConfig::FetchCommand
- Inherits:
-
HammerCLIForeman::Command
- Object
- HammerCLIForeman::Command
- HammerCLIForemanVirtWhoConfigure::VirtWhoConfig::FetchCommand
- Defined in:
- lib/hammer_cli_foreman_virt_who_configure/config.rb
Instance Method Summary collapse
Instance Method Details
#execute ⇒ Object
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/hammer_cli_foreman_virt_who_configure/config.rb', line 139 def execute data = send_request if option_output path = File.(option_output) if File.exist?(path) # this could be a security issue, the file should be readable only by the user output.print_error( _('Could not save the script'), _('File at %{path} already exists, please specify a different path.') % { :path => path } ) return HammerCLI::EX_USAGE else File.write(path, data, perm: 0700, mode: File::RDWR | File::CREAT | File::EXCL) return HammerCLI::EX_OK end else puts data return HammerCLI::EX_OK end end |
#transform_format(data) ⇒ Object
160 161 162 |
# File 'lib/hammer_cli_foreman_virt_who_configure/config.rb', line 160 def transform_format(data) data['virt_who_config_script'] end |