You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
:query:
- select class_name as %{key} from %{ostype} as a,classes as b where a.class_id=b.class_id;
- select value from node_params as a,nodes as b where a.node_id=b.node_id and b.fqdn='%{::fqdn}' and params='%{key}'
:logger: console
#i want use qurey one to select 'classes'
hiera -c /etc/hiera.yaml -a ostype=Debian classes
['nginx','ntp']
debian server auto include Debian table classes ,this is true.
:backends:
mysql
:mysql:
:host : localhost
:user : root
:pass : 123456
:database : config
:query:
- select class_name as %{key} from %{ostype} as a,classes as b where a.class_id=b.class_id;
- select value from node_params as a,nodes as b where a.node_id=b.node_id and b.fqdn='%{::fqdn}' and params='%{key}'
:logger: console
#i want use qurey one to select 'classes'
hiera -c /etc/hiera.yaml -a ostype=Debian classes
['nginx','ntp']
debian server auto include Debian table classes ,this is true.
but query two is not work.
hiera -c /etc/hiera.yaml ::fqdn=squid.example.com nginx::params::config_file_abs_path
it will execut query one language.
so how can make it work? juge filed name is exists in table ?
i want all is work
hiera -c hiera.yaml nginx::params::config_file_abs_path ::fqdn=squid.example.com
["/etc/nginx/nginx.conf"]
mysql> show tables;
+------------------+
| Tables_in_config |
+------------------+
| Debian |
| Redhat |
| classes |
| node_params |
| nodes |
| test |
+------------------+
mysql> select * from classes;
+----------+------------+
| class_id | class_name |
+----------+------------+
| 2 | nginx |
| 1 | ntp |
| 8 | puppet |
| 7 | test |
+----------+------------+
4 rows in set (0.00 sec)
mysql> select * from nodes
-> ;
+---------+--------------------+
| node_id | fqdn |
+---------+--------------------+
| 2 | debian.example.com |
| 1 | squid.example.com |
+---------+--------------------+
2 rows in set (0.00 sec)
mysql> select * from node_params;
+---------+-------------------------------------+-----------------------+
| node_id | param | value |
+---------+-------------------------------------+-----------------------+
| 1 | nginx::params::config_file_abs_path | /etc/nginx/nginx.conf |
+---------+-------------------------------------+-----------------------+
1 row in set (0.00 sec)
mysql> select * from Debian;
+----------+
| class_id |
+----------+
| 1 |
| 2 |
+----------+
2 rows in set (0.00 sec)
mysql> select * from Redhat;
+----------+
| class_id |
+----------+
| 7 |
+----------+
1 row in set (0.00 sec)
The text was updated successfully, but these errors were encountered: