(
cls, platform: Platform, messages: ServiceSpecificMessages
)
| 54 | |
| 55 | @classmethod |
| 56 | def generate( |
| 57 | cls, platform: Platform, messages: ServiceSpecificMessages |
| 58 | ) -> ServiceMissingError: |
| 59 | service = messages.service |
| 60 | |
| 61 | supported = False |
| 62 | if platform.distro in ["centos", "rhel"] or "rhel" in platform.distro_like: |
| 63 | supported = True |
| 64 | if platform.distro_major_version == "7": |
| 65 | service_start_cmd = messages.service_start_cmd_el_7 |
| 66 | else: |
| 67 | service_start_cmd = messages.service_start_cmd_el |
| 68 | not_installed_clause = messages.not_installed_clause_el |
| 69 | install_instructions = messages.install_instructions_el |
| 70 | |
| 71 | elif ( |
| 72 | platform.distro in ["ubuntu", "debian"] or "debian" in platform.distro_like |
| 73 | ): |
| 74 | supported = True |
| 75 | service_start_cmd = messages.service_start_cmd_deb |
| 76 | not_installed_clause = messages.not_installed_clause_deb |
| 77 | install_instructions = messages.install_instructions_deb |
| 78 | |
| 79 | if supported: |
| 80 | instructions = dedent( |
| 81 | f"""\ |
| 82 | If {service} is installed, but not running try: |
| 83 | |
| 84 | {service_start_cmd} |
| 85 | |
| 86 | If {service} is not installed, {not_installed_clause}: |
| 87 | |
| 88 | """ |
| 89 | ).format( |
| 90 | service=service, |
| 91 | service_start_cmd=service_start_cmd, |
| 92 | not_installed_clause=not_installed_clause, |
| 93 | ) |
| 94 | instructions += install_instructions |
| 95 | elif platform.os == "Linux": |
| 96 | instructions = dedent( |
| 97 | f"""\ |
| 98 | You are on Linux using {platform.distro_name}, which is not |
| 99 | one of our generally supported distributions. We recommend |
| 100 | you use vagrant for local development with something like: |
| 101 | |
| 102 | vagrant init stackstorm/st2 |
| 103 | vagrant up |
| 104 | vagrant ssh |
| 105 | |
| 106 | Please see: https://docs.stackstorm.com/install/vagrant.html |
| 107 | |
| 108 | For anyone who wants to attempt local development without vagrant, |
| 109 | you are pretty much on your own. At a minimum you need to install |
| 110 | and start {service} with something like: |
| 111 | |
| 112 | {messages.service_start_cmd_generic} |
| 113 |
no test coverage detected