Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3772399
D1186.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D1186.diff
View Options
diff --git a/roles/dbserver-mysql/grc/files/grcat.config b/roles/dbserver-mysql/grc/files/grcat.config
new file mode 100644
--- /dev/null
+++ b/roles/dbserver-mysql/grc/files/grcat.config
@@ -0,0 +1,68 @@
+# -------------------------------------------------------------
+# MySQL configuration — grcat configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Author: Jaime Crespo (Wikimedia)
+# Source file: roles/dbserver-mysql/grc/files/grcat.config
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+#default word color
+#regexp=[\w.,\:\-_/]+
+regexp=.+
+colours=green
+-
+
+#table borders
+regexp=[+\-]+[+\-]|[|]
+colours=red
+-
+
+#data in ( ) and ' '
+regexp=\([\w\d,']+\)
+colours=red
+-
+
+#numeric
+regexp=\s[\d\.]+\s*($|(?=\|))
+colours=yellow
+-
+
+#date
+regexp=\d{4}-\d{2}-\d{2}
+colours=cyan
+-
+#time
+regexp=\d{2}:\d{2}:\d{2}
+colours=cyan
+-
+
+#IP
+regexp=(\d{1,3}\.){3}\d{1,3}(:\d{1,5})?
+colours=cyan
+-
+
+#schema
+regexp=`\w+`
+colours=yellow
+-
+
+#email
+regexp=[\w\.\-_]+@[\w\.\-_]+
+colours=magenta
+-
+
+#row delimeter when using \G key
+regexp=[*]+.+[*]+
+count=stop
+colours=white
+-
+
+#column names when using \G key
+regexp=^\s*\w+:
+colours=white
diff --git a/roles/dbserver-mysql/grc/init.sls b/roles/dbserver-mysql/grc/init.sls
new file mode 100644
--- /dev/null
+++ b/roles/dbserver-mysql/grc/init.sls
@@ -0,0 +1,36 @@
+# -------------------------------------------------------------
+# Salt — Database server — MySQL
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Credit: Jaime Crespo (@Jynus)
+# Created: 2017-11-09
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% from "map.jinja" import dirs with context %}
+
+# -------------------------------------------------------------
+# Coloration grc configuration file for MySQL client
+#
+# “ This is more than pure aestetics- DBAs are looking at this output
+# for long hours, a bit of color (disabled by default) will make
+# their life easier.
+#
+# Enable with:
+# mysql --pager='grcat /etc/mysql/grcat.config | less -RSFXin'
+#
+# ” -- Jaime Crespo
+#
+# Note it's deployed instead in share dir to be able to `grc mysql`.
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{{ dirs.share }}/conf.mysql:
+ file.managed:
+ - source: salt://roles/dbserver-mysql/grc/files/grcat.config
+
+{{ dirs.etc }}/grc.conf:
+ file.append:
+ - text: |
+ # MySQL mysql command
+ (^|[/\w\.]+/)mysql\s?
+ conf.mysql
diff --git a/roles/dbserver-mysql/init.sls b/roles/dbserver-mysql/init.sls
--- a/roles/dbserver-mysql/init.sls
+++ b/roles/dbserver-mysql/init.sls
@@ -8,3 +8,4 @@
include:
- .mysql-server
+ - .grc
diff --git a/roles/shellserver/userland-software/base.sls b/roles/shellserver/userland-software/base.sls
--- a/roles/shellserver/userland-software/base.sls
+++ b/roles/shellserver/userland-software/base.sls
@@ -57,6 +57,7 @@
- mosh
- cmatrix
- figlet
+ - grc
- nmap
- toilet
- tmux
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 03:51 (21 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2261722
Default Alt Text
D1186.diff (3 KB)
Attached To
Mode
D1186: Provide generic colouriser
Attached
Detach File
Event Timeline
Log In to Comment