-
Notifications
You must be signed in to change notification settings - Fork 118
Add suse support (with mysql defaults this time) #146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR, @ghormoon. Unfortunately, this is failing with conflicting IDs in the CI. Please uncomment these two lines in order to test on openSUSE during this PR's development:
Lines 145 to 146 in 25de37e
| # default-opensuse-leap-152-master-py3: {extends: '.test_instance'} | |
| # default-opensuse-tmbl-latest-master-py3: {extends: '.test_instance'} |
I've run these in my fork and you can see the results so far:
- https://gitlab.com/myii/zabbix-formula/-/jobs/1186061144
- https://gitlab.com/myii/zabbix-formula/-/jobs/1186061146
local:
Data failed to compile:
----------
Detected conflicting IDs, SLS IDs need to be globally unique.
The conflicting ID is 'zabbix_repo' and is found in SLS 'base:zabbix.agent.repo' and SLS 'base:zabbix.server.repo'
----------
Detected conflicting IDs, SLS IDs need to be globally unique.
The conflicting ID is 'zabbix_repo' and is found in SLS 'base:zabbix.server.repo' and SLS 'base:zabbix.frontend.repo'
zabbix/repo.sls
Outdated
| - gpgkey: https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-79EA5ED4 | ||
| {%- elif salt['grains.get']('os_family') == 'Suse' %} | ||
| zabbix_repo: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed this part, thanks @myii for pointing this issue. Variable must be used in state id to prevent duplicatees.
| zabbix_repo: | |
| {{ id_prefix }}_repo: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hatifnatt Yes, unfortunately that's not enough, getting some strange errors after fixing that:
- https://gitlab.com/myii/zabbix-formula/-/jobs/1186085485
- https://gitlab.com/myii/zabbix-formula/-/jobs/1186085486
[ERROR ] An un-handled exception was caught by salt's global exception handler:
StopIteration:
Traceback (most recent call last):
File "/usr/bin/salt-call", line 8, in <module>
sys.exit(salt_call())
File "/usr/lib/python3.8/site-packages/salt/scripts.py", line 449, in salt_call
client.run()
File "/usr/lib/python3.8/site-packages/salt/cli/call.py", line 58, in run
caller.run()
File "/usr/lib/python3.8/site-packages/salt/cli/caller.py", line 112, in run
ret = self.call()
File "/usr/lib/python3.8/site-packages/salt/cli/caller.py", line 219, in call
ret["return"] = self.minion.executors[fname](
File "/usr/lib/python3.8/site-packages/salt/loader.py", line 1235, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/usr/lib/python3.8/site-packages/salt/loader.py", line 2268, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/usr/lib/python3.8/site-packages/salt/loader.py", line 2283, in _run_as
return _func_or_method(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/salt/executors/direct_call.py", line 12, in execute
return func(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/salt/loader.py", line 1235, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/usr/lib/python3.8/site-packages/salt/loader.py", line 2268, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/usr/lib/python3.8/site-packages/salt/loader.py", line 2283, in _run_as
return _func_or_method(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/salt/modules/state.py", line 1115, in highstate
ret = st_.call_highstate(
File "/usr/lib/python3.8/site-packages/salt/state.py", line 4527, in call_highstate
return self.state.call_high(high, orchestration_jid)
File "/usr/lib/python3.8/site-packages/salt/state.py", line 3251, in call_high
high, ext_errors = self.reconcile_extend(high)
File "/usr/lib/python3.8/site-packages/salt/state.py", line 1627, in reconcile_extend
state_type = next(x for x in body if not x.startswith("__"))
StopIteration
Traceback (most recent call last):
File "/usr/bin/salt-call", line 8, in <module>
sys.exit(salt_call())
File "/usr/lib/python3.8/site-packages/salt/scripts.py", line 449, in salt_call
client.run()
File "/usr/lib/python3.8/site-packages/salt/cli/call.py", line 58, in run
caller.run()
File "/usr/lib/python3.8/site-packages/salt/cli/caller.py", line 112, in run
ret = self.call()
File "/usr/lib/python3.8/site-packages/salt/cli/caller.py", line 219, in call
ret["return"] = self.minion.executors[fname](
File "/usr/lib/python3.8/site-packages/salt/loader.py", line 1235, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/usr/lib/python3.8/site-packages/salt/loader.py", line 2268, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/usr/lib/python3.8/site-packages/salt/loader.py", line 2283, in _run_as
return _func_or_method(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/salt/executors/direct_call.py", line 12, in execute
return func(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/salt/loader.py", line 1235, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/usr/lib/python3.8/site-packages/salt/loader.py", line 2268, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/usr/lib/python3.8/site-packages/salt/loader.py", line 2283, in _run_as
return _func_or_method(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/salt/modules/state.py", line 1115, in highstate
ret = st_.call_highstate(
File "/usr/lib/python3.8/site-packages/salt/state.py", line 4527, in call_highstate
return self.state.call_high(high, orchestration_jid)
File "/usr/lib/python3.8/site-packages/salt/state.py", line 3251, in call_high
high, ext_errors = self.reconcile_extend(high)
File "/usr/lib/python3.8/site-packages/salt/state.py", line 1627, in reconcile_extend
state_type = next(x for x in body if not x.startswith("__"))
StopIterationThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ghormoon @hatifnatt Looks like these extend blocks need to handle Suse as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ghormoon I see what the problem is in the repo.sls files (the extends haven't been set correctly). Just trying something in my fork and will link inline with the results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes there is a problem with extend
https://gitlab.com/myii/zabbix-formula/-/jobs/1186085485#L1687-#L1691 it's rendering as simple {} that's does not look like correct yaml.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hatifnatt Actually, the current code isn't even hitting the {}, it's actually splitting the RedHat block with a Suse block. I've mentioned the fixes below.
zabbix/agent/repo.sls
Outdated
| {% elif salt['grains.get']('os_family') == 'Suse' -%} | ||
| pkgrepo: | ||
| - require_in: | ||
| - pkg: zabbix-agent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| {% elif salt['grains.get']('os_family') == 'Suse' -%} | |
| pkgrepo: | |
| - require_in: | |
| - pkg: zabbix-agent |
This current method also splits the RedHat block, which will cause problems there.
All this file needs is the line above to be changed:
- {% if salt['grains.get']('os_family') == 'Debian' -%}
+ {% if salt['grains.get']('os_family') in ['Debian', 'Suse'] -%}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, this single line change is also required here:
zabbix-formula/zabbix/server/repo.sls
Line 15 in c9aeb37
| {% if salt['grains.get']('os_family') == 'Debian' -%} |
zabbix/frontend/repo.sls
Outdated
| {% elif salt['grains.get']('os_family') == 'Suse' -%} | ||
| pkgrepo: | ||
| - require_in: | ||
| - pkg: zabbix-frontend-php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zabbix/proxy/repo.sls
Outdated
| {% elif salt['grains.get']('os_family') == 'Suse' -%} | ||
| pkgrepo: | ||
| - require_in: | ||
| - pkg: zabbix-proxy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@ghormoon After applying the fixes mentioned above, the good news is that this is almost passing on openSUSE Leap but will need some more work on openSUSE Tumbleweed:
|
That's because Tumbleweed @ghormoon are you using openSUSE Tumbleweed or SLES? |
|
I'm using SLES 15, but honestly i didn't run the kitchen test, i just tried it manually :) my link is https://repo.zabbix.com/zabbix/5.2/sles/15/x86_64/ on my SLES 15 VM (the 5.2 is because of variable), so the problem is the tumbleweed versioning. leap is much closer to sles, so it makes sense to fix the path for files expected in tests i'll have a look on the suggestions and try to apply and test them locally on sles, i just got to it and you're quite active :) |
@hatifnatt @ghormoon I've tried a quick fix locally (using Kitchen) and there's deeper issues with Tumbleweed, for example: [INFO ] Executing state pkg.installed for [zabbix-server]
[DEBUG ] Could not LazyLoad pkg.check_db: 'pkg.check_db' is not available.
[DEBUG ] targeting package: zabbix-server-mysql
[DEBUG ] Calling Zypper: systemd-run --scope zypper --non-interactive --no-refresh --no-refresh install --auto-agree-with-licenses --name zabbix-server-mysql
[INFO ] Executing command ['systemd-run', '--scope', 'zypper', '--non-interactive', '--no-refresh', '--no-refresh', 'install', '--auto-agree-with-licenses', '--name', 'zabbix-server-mysql'] in directory '/root'
[ERROR ] Command '['systemd-run', '--scope', 'zypper', '--non-interactive', '--no-refresh', '--no-refresh', 'install', '--auto-agree-with-licenses', '--name', 'zabbix-server-mysql']' failed with return code: 4
[ERROR ] stdout: Warning: The flag --no-refresh can only be used once.
Loading repository data...
Reading installed packages...
Resolving package dependencies...
Problem: nothing provides libevent-2.1.so.6()(64bit) needed by zabbix-server-mysql-4.4.10-1.el15.x86_64
Solution 1: do not install zabbix-server-mysql-4.4.10-1.el15.x86_64
Solution 2: break zabbix-server-mysql-4.4.10-1.el15.x86_64 by ignoring some of its dependencies
Choose from above solutions by number or cancel [1/2/c/d/?] (c): c
[ERROR ] stderr: Running scope as unit: run-r0a507cfdfb0f48a7bca8fd3fdc509a86.scope
[ERROR ] retcode: 4
[ERROR ] An error was encountered while installing package(s): Zypper command failure: Running scope as unit: run-r0a507cfdfb0f48a7bca8fd3fdc509a86.scopeSo let's not worry about Tumbleweed for now and just get Leap-15 up and running. In fact, I'll just fix the test and push the fixes here and then this PR can be merged. |
|
Just for reference, this was the fix I was going to suggest (but not going to apply now): {%- elif salt['grains.get']('os_family') == 'Suse' %}
{#- TODO: When the v5 `map.jinja` is introduced to this formula, this should be provided via. the relevant `oscodename` parameter file #}
{%- set majorrelease = '15' if grains.get('oscodename', '') == 'openSUSE Tumbleweed' else grains['osmajorrelease'] %}
{{ id_prefix }}_repo:
pkgrepo.managed:
- name: zabbix
- humanname: "Zabbix Official Repository"
- baseurl: https://repo.zabbix.com/zabbix/{{ zabbix.version_repo }}/sles/{{ majorrelease }}/x86_64/
- gpgcheck: 1
- gpgkey: https://repo.zabbix.com/zabbix/{{ zabbix.version_repo }}/sles/{{ majorrelease }}/x86_64/repodata/repomd.xml.key
- gpgautoimport: True |
|
yeah, it would be asking for dependency problems like you have in the log sooner or later. even if we were lucky now and it passed, we might get and bug reported in a month or two, so i'd stick to that only leap/sles is supported. |
|
@ghormoon OK, here's the final bit then, to get Leap-15 passing in GitLab CI: zabbix-formula/test/integration/default/controls/config_spec.rb Lines 41 to 48 in 2c67b11
Please add the case platform[:family]
when 'debian'
server_file_group = 'root'
server_file_mode = '0644'
setting_dbsocket = '/var/run/mysqld/mysqld.sock'
when 'fedora'
server_file_group = 'zabbixsrv'
when 'suse'
setting_dbsocket = '/run/mysql/mysql.sock'
endThen this PR should be ready for merging. Would you prefer to do it or shall I push all of the changes myself? |
|
ok, i tried to apply the changes and allowing leap on ci, we'll see if it passes now :) |
|
Thanks, @ghormoon -- all working nicely. |
|
🎉 This PR is included in version 1.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
* Automated using myii/ssf-formula#315 * Completes #146
# [1.2.0](v1.1.0...v1.2.0) (2021-05-11) ### Continuous Integration * add `arch-master` to matrix and update `.travis.yml` [skip ci] ([95523a9](95523a9)) * **kitchen+gitlab:** adjust matrix to add `3003` [skip ci] ([1d237e8](1d237e8)) * **travis:** maintain sync with GitLab CI [skip ci] ([5c81ca1](5c81ca1)), closes [#146](#146) ### Features * **agent:** allow use of string Server and ServerActive ([59dff0a](59dff0a))
PR progress checklist (to be filled in by reviewers)
What type of PR is this?
Primary type
[feat]A new featureDoes this PR introduce a
BREAKING CHANGE?No.
Related issues and/or pull requests
Replaces #140
Describe the changes you're proposing
Following up on my colleagues work from #140 i made adjustments to the defaults to go with mysql as you prefer. Please let me know if there are any other issues i did not address properly.