Skip to content

Commit

Permalink
Add support for post-install-script being a URL
Browse files Browse the repository at this point in the history
  • Loading branch information
skycastlelily committed Jan 22, 2024
1 parent 9519817 commit dacda9d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tmt/steps/provision/artemis.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,22 @@ def _create(self) -> None:
# TODO: spot instance

if self.post_install_script:
data['post_install_script'] = self.post_install_script
if tmt.utils.is_url(self.post_install_script):
try:
response = requests.get(self.post_install_script)
response.raise_for_status()

except requests.exceptions.RequestException:
raise ArtemisProvisionError(
"failed to get the post_install_script file")

post_install_script = response.text
else:
self.info('post-install-script argument is treated as a raw script')

post_install_script = post_install_script.replace('\\n', '\n')

data['post_install_script'] = post_install_script

if self.log_type:
data['log_types'] = list({tuple(log.split('/', 1)) for log in self.log_type})
Expand Down

0 comments on commit dacda9d

Please sign in to comment.