mysql_grants.present fails to execute with salt-stack - salt-stack

I'm new with saltstack, state file that i'm using:
mybd:
mysql_database.present
user22:
mysql_grants.present:
- grant: ALL PRIVILEGES
- database: 'mybd.*'
- user: user22
- host: localhost
- connection_user: root
- connection_host: localhost
- connection_pass: ''
- connection_unix_socket: /tmp/mysql.sock
- connection_charset: utf8
I am getting the following error when applying a mysql state:
ID: mybd
Function: mysql_database.present
Result: True
Comment: Database mybd is already present
Started: 09:05:09.366441
Duration: 5.835 ms
Changes:
ID: user22
Function: mysql_grants.present
Result: False
Comment: Failed to execute: "GRANT ALL PRIVILEGES ON mybd.* TO user22#localhost"
Started: 09:05:09.372849
Duration: 76.012 ms
Changes:
Summary for user
Succeeded: 1
Failed: 1
but when I go to mysql i notice that the privilege is added !
I don't know what I am doing wrong. Is there somebody who knows how to properly grant permissions to a user in mysql through salt-stack?
Salt Version:
Salt Version:
Salt: 2015.8.0
Dependency Versions:
Jinja2: 2.7.2
M2Crypto: 0.31.0
Mako: Not Installed
PyYAML: 3.11
PyZMQ: 15.3.0
Python: 2.7.5 (default, Nov 16 2020, 22:23:17)
RAET: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4
cffi: Not Installed
cherrypy: Not Installed
dateutil: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
libnacl: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.6.2
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
python-gnupg: Not Installed
smmap: Not Installed
timelib: Not Installed
System Versions:
dist: centos 7.9.2009 Core
machine: x86_64
release: 3.10.0-1160.15.2.el7.x86_64
system: CentOS Linux 7.9.2009 Core
mysql version:
mysql Ver 15.1 Distrib 10.3.31-MariaDB, for Linux (x86_64) using readline 5.1

To know the real answer you will have to look at the minions log file. If there are any errors listed that would be why the mysql.grant_add failed.
however the way the state works is it tries to determine if the grant is already there by using the mysql module to run mysql.grant_exists and look for the grant in the database. If it doesn't find it it will run the mysql.grant_add function.
mysql.grant_add will generate the query for the grant based on the information, run the query, if either of those processes fail it will report the failure in the minion log.
After that mysql.grant_add will run mysql.grant_exists to see if the grant was added. If that doesn't return properly it will report the failure. So the question is if mysql.grant_exists can see the grant.
Also with you being on such an old version of salt but a newer version of mysql it is possible that the grant table is not returning in a way that mysql.grant_exists can detect the grant. In which case it will detect as a failure and still be able to add.

Related

MariaDB System Versioned Tables Do Not Work Locally Even After MariaDB upgrade

So I used to have mysql installed on my mac via homebrew. I stared by uninstalling it and then installed maria with brew install mariadb
This shows me this version
> mysql --version
mysql Ver 15.1 Distrib 10.7.3-MariaDB, for osx10.17 (arm64) using EditLine wrapper
and this:
mariadb --version
mariadb Ver 15.1 Distrib 10.7.3-MariaDB, for osx10.17 (arm64) using EditLine wrapper
I can run mariadb and connect to it fine with this command:
mariadb -u root -p
However, I am not able to use the new feature of mariaDB called system versioned tables.
I have followed this guide: https://mariadb.com/kb/en/system-versioned-tables/ and entered this command
MySQL [(none)]> CREATE TABLE t ( x INT ) WITH SYSTEM VERSIONING;
Which gives this error:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SYSTEM VERSIONING' at line 1
To test this further, I created a MariaDB instance in aws and connected to it locally with the same command which works fine. The version that RDS supports is 10.6
Question: "Why can't does my local instance of mariadb not recognize the keyword SYSTEM?
I am not sure how to debug this locally and I would like to know why this version of mariadb is unable to recognize these command locally. Looking for some debugging tips.
EDIT: Another thing to check was to select version while in the mariadb console
MySQL [(none)]> select version();
+-----------+
| version() |
+-----------+
| 8.0.28 |
+-----------+
8.0.28 is a MySQL version, which doesn't have System Versioned Tables, only MariaDB does (at the time of this posting anyway).
As noted, mysql --version only shows the version of the MySQL (or MariaDB via compatibility links) client. It doesn't show the server version.

How to copy file from Salt-Minion [Windows] to Salt-Master. "cp.push module not working"

I'm trying to copy file from Salt-Minion [Windows] to Salt-Master using cp.push module. Although it's works fine in Linux Minion's. The only problem I'm facing for Windows Minion's. Its returning false. Is there any other way to perform this task please let know. It would be very helpful to me.
Salt-Master
Version: 3002.2
OS: RHEL7
Salt-Minion
Version: 3002.2
OS: Windows Server 2016

Why is yum re-creating default nginx config file on yum update on RHEL7?

I installed nginx via yum package on RHEL7. I added my config as
/etc/nginx/conf.d/my.conf
and deleted the config file shipped with the package
/etc/nginx/conf.d/default.conf
Recently, nginx package was updated via yum update. Now, the default.conf file is present again. I would have expected that yum doesn't touch default config files if they were changed or deleted.
Is this normal yum behavior? Here some information about the RHEL version and nginx package.
root#host: [~]# yum info nginx
Loaded plugins: langpacks, product-id, rhnplugin, search-disabled-repos
This system is receiving updates from RHN Classic or Red Hat Satellite.
Installed Packages
Name : nginx
Arch : x86_64
Epoch : 1
Version : 1.14.1
Release : 1.el7_4.ngx
Size : 2.6 M
Repo : installed
From repo : nginx
Summary : High performance web server
URL : http://nginx.org/
License : 2-clause BSD-like license
Description : nginx [engine x] is an HTTP and reverse proxy server, as well as
: a mail proxy server.
I upgrade the package from 1.14.0 to version 1.14.1 shown above.
root#host: [~]# nginx -v
nginx version: nginx/1.14.1
Redhat version:
root#host: [~]# hostnamectl
Static hostname: host.example.com
Icon name: computer-vm
Chassis: vm
Machine ID: SOME-ID
Boot ID: ANOTHER-ID
Virtualization: vmware
Operating System: Red Hat Enterprise Linux
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.5:GA:server
Kernel: Linux 3.10.0-862.14.4.el7.x86_64
Architecture: x86-64
If I rename my.conf to default.conf, it doesn't get replaced on a yum update.

WooCommerce Gateway PayPal Express Checkout requires OpenSSL >= 1.0.1

I am running OSX Sierra 10.12.5 with PHP 5.6.30 and have a local Wordpress / WooCommerce setup with the "woocommerce-gateway-paypal-express-checkout" plugin installed. I am seeing an error in the admin relating to my OpenSSL version:
WooCommerce Gateway PayPal Express Checkout requires OpenSSL >= 1.0.1 to be installed on your server
I also have other issues with cURL request to https pages, as well as the Wordpress update check not working; which I understand to be related.
In my php info, I have this entry for OpenSSL
OpenSSL support enabled
OpenSSL Library Version LibreSSL 2.2.7
OpenSSL Header Version LibreSSL 2.2.7
Openssl default config /private/etc/ssl/openssl.cnf
From the command line, the version is reported as:
openssl version
OpenSSL 0.9.8zh 14 Jan 2016
which openssl
/usr/bin/openssl
Lastly, the server environment reported by WooCommerce status is:
### Server Environment ###
Server Info: Apache/2.4.25 (Unix) LibreSSL/2.2.7 PHP/5.6.30
PHP Version: 5.6.30
PHP Post Max Size: 8 MB
PHP Time Limit: 31
PHP Max Input Vars: 1000
cURL Version: 7.51.0
SecureTransport
I am at a loss as to how to fix this. I understand that the LibreSSL is a branch of OpenSSL, and is more secure. I have searched for a solution, and several seem to suggest running brew install openssl and then brew upgrade openssl. This doesn't seem to fix the problem. I know there are several similar or related questions, but most of the responses were either a couple of years old, or seemed to cause other problems.
I have several machines with this problem and would really like to get a better understanding for what is going wrong.

oservium cannot add_device but can snmpwalk and fping

Even after I made sure fping in config same as whereis fping output, I'm still cannot add any device, even localhost.
I also had made sure that snmpwalk successul before running add_device.php
OS: Centos 6 amd64
[root#nms observium]# ./add_device.php -d 127.0.0.1 public v2c
DEBUG!
Observium CE 0.15.6.6430
Add Device(s)
Wrong process status! Try fix..
CMD[/opt/observium/scripts/distro]
EXITCODE[0]
RUNTIME[0.0295s]
STDOUT[
Linux|2.6.32-573.8.1.el6.x86_64|amd64|CentOS|6.7
]
CMD[/usr/bin/env python --version 2>&1]
EXITCODE[0]
RUNTIME[0.039s]
STDOUT[
Python 2.6.6
]
SQL[SELECT version()]
RUNTIME[0.01287103s]
CMD[/usr/bin/snmpget --version 2>&1]
EXITCODE[0]
RUNTIME[0.0169s]
STDOUT[
NET-SNMP version: 5.5
]
CMD[/usr/bin/rrdtool --version |head -n1]
EXITCODE[0]
RUNTIME[0.0891s]
STDOUT[
RRDtool 1.3.8 Copyright 1997-2009 by Tobias Oetiker <tobi#oetiker.ch>
]
Software versions:
OS: Linux 2.6.32-573.8.1.el6.x86_64 [amd64] (CentOS 6.7)
PHP: 5.3.3
Python: Python 2.6.6
MySQL: 5.1.73
SNMP: NET-SNMP 5.5
RRDtool: 1.3.8
Try to add 127.0.0.1:
SQL[SELECT COUNT(*) FROM `devices` WHERE `hostname` = '127.0.0.1']
RUNTIME[0.04451895s]
Could not resolve 127.0.0.1.
Devices failed: 1.
Any tips/hints would be great.
Solved by using hostname instead of IP address
Add hostname entry in /etc/hosts of observium server, then run ./add_device hostname community v2c

Resources