|
1 | 1 | from pathlib import PurePath |
2 | 2 |
|
3 | 3 | from buildbot.plugins import util |
4 | | -from configuration.steps.commands.base import Command |
| 4 | +from configuration.steps.commands.base import BashScriptCommand, Command |
5 | 5 |
|
6 | 6 |
|
7 | 7 | class CreateS3Bucket(Command): |
@@ -143,67 +143,33 @@ def as_cmd_arg(self) -> list[str]: |
143 | 143 | ) |
144 | 144 |
|
145 | 145 |
|
146 | | -class UBIEnableFIPS(Command): |
| 146 | +class UBIEnableFIPS(BashScriptCommand): |
147 | 147 | """ |
148 | | - A command to enable FIPS mode in Red Hat-based systems. |
149 | | - Attributes: |
150 | | - name (str): The name of the command. |
151 | | - workdir (PurePath): The working directory for the command. |
| 148 | + A command to enable FIPS mode on UBI containers. |
152 | 149 | """ |
153 | 150 |
|
154 | 151 | def __init__(self): |
155 | | - name = "Enable FIPS in UBI container" |
156 | | - super().__init__(name=name, workdir=PurePath("."), user="root") |
157 | | - |
158 | | - def as_cmd_arg(self) -> list[str]: |
159 | | - return [ |
160 | | - "bash", |
161 | | - "-exc", |
162 | | - """ |
163 | | - # Check if OpenSSL is installed |
164 | | - if ! command -v openssl &> /dev/null; then |
165 | | - echo "OpenSSL is not installed." |
166 | | - exit 1 |
167 | | - fi |
168 | | -
|
169 | | - # Enable FIPS mode in RedHat OpenSSL |
170 | | - sed -i -e '/\[ evp_properties \]/a default_properties = fips=yes' \ |
171 | | - -e '/opensslcnf.config/a .include = /etc/crypto-policies/back-ends/openssl_fips.config' \ |
172 | | - -e '/\[provider_sect\]/a fips = fips_sect' \ |
173 | | - /etc/pki/tls/openssl.cnf |
174 | | -
|
175 | | -
|
176 | | - # List providers. If FIPS is not listed, it may not be enabled. |
177 | | - if ! openssl list -providers | grep -q 'fips'; then |
178 | | - echo "FIPS provider is not enabled." |
179 | | - exit 1 |
180 | | - fi |
181 | | -
|
182 | | - # If FIPS is enabled then generating a hash with MD5 should fail |
183 | | - if openssl dgst -md5 /dev/null &> /dev/null; then |
184 | | - echo "FIPS mode is not enabled." |
185 | | - exit 1 |
186 | | - else |
187 | | - echo "FIPS mode is enabled." |
188 | | - exit 0 |
189 | | - fi |
190 | | - """, |
191 | | - ] |
| 152 | + super().__init__(script_name="ubi_enable_fips.sh", user="root") |
192 | 153 |
|
193 | 154 |
|
194 | | -class AnyCommand(Command): |
| 155 | +class GetSSLTests(BashScriptCommand): |
195 | 156 | """ |
196 | | - A command that executes any arbitrary shell command. |
197 | | - This command is useful for running custom shell commands that do not fit into predefined categories. |
198 | | - Attributes: |
199 | | - name (str): The name of the command. |
200 | | - workdir (PurePath): The working directory for the command. |
201 | | - command (str): The shell command to execute. Support for interpolation is provided. |
| 157 | + A command to extract the list of SSL tests to run from the MariaDB test suite. |
202 | 158 | """ |
203 | 159 |
|
204 | | - def __init__(self, name: str, command: str, workdir: PurePath = PurePath(".")): |
205 | | - super().__init__(name=name, workdir=workdir) |
206 | | - self.command = command |
| 160 | + def __init__(self, output_file: str): |
| 161 | + args = [output_file] |
| 162 | + super().__init__(script_name="get_fips_mtr_tests.sh", args=args) |
207 | 163 |
|
208 | | - def as_cmd_arg(self) -> list[str]: |
209 | | - return ["bash", "-exc", util.Interpolate(self.command)] |
| 164 | + |
| 165 | +class LDDCheck(BashScriptCommand): |
| 166 | + """ |
| 167 | + A command to check dynamic library dependencies of specified binaries. |
| 168 | + """ |
| 169 | + |
| 170 | + def __init__( |
| 171 | + self, |
| 172 | + binary_checks: dict[str, list[str]], |
| 173 | + ): |
| 174 | + args = [f"{binary}:{','.join(libs)}" for binary, libs in binary_checks.items()] |
| 175 | + super().__init__(script_name="ldd_check.sh", args=args) |
0 commit comments