updated maildb state
This commit is contained in:
parent
e457e62182
commit
de7b753440
@ -2,7 +2,6 @@
|
||||
maildb:
|
||||
enabled: true
|
||||
appdir: /usr/local/apps/maildb
|
||||
datadir: /usr/local/data/maildb
|
||||
configfile: /usr/local/apps/maildb/maildb.cfg
|
||||
config:
|
||||
file: /usr/local/apps/maildb/maildb.ini
|
||||
|
@ -4,7 +4,6 @@ maildb-pkg:
|
||||
pkg.latest:
|
||||
- pkgs:
|
||||
- python3
|
||||
- python3-mysqldb
|
||||
- python3-psycopg2
|
||||
|
||||
maildb-user-vmail:
|
||||
@ -20,14 +19,6 @@ maildb-apps-dir:
|
||||
- mode: 0755
|
||||
- makedirs: true
|
||||
|
||||
maildb-data-dir:
|
||||
file.directory:
|
||||
- name: {{ maildb.datadir }}
|
||||
- user: vmail
|
||||
- group: vmail
|
||||
- mode: 0755
|
||||
- makedirs: true
|
||||
|
||||
maildb-script:
|
||||
file.managed:
|
||||
- name: {{ maildb.appdir }}/maildb.py
|
||||
@ -38,15 +29,3 @@ maildb-script:
|
||||
- require:
|
||||
- file: maildb-apps-dir
|
||||
- file: maildb-data-dir
|
||||
|
||||
maildb-config:
|
||||
file.managed:
|
||||
- name: {{ maildb.appdir }}/maildb.ini
|
||||
- source: salt://maildb/maildb.ini.j2
|
||||
- user: vmail
|
||||
- group: vmail
|
||||
- mode: 0755
|
||||
- template: jinja
|
||||
- require:
|
||||
- file: maildb-apps-dir
|
||||
- file: maildb-data-dir
|
||||
|
@ -1,6 +0,0 @@
|
||||
## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
|
||||
{%- from "maildb/map.jinja" import maildb with context %}
|
||||
[maildb]
|
||||
{%- for param, value in maildb.db.items() %}
|
||||
{{ param }}={{ value }}
|
||||
{%- endfor %}
|
@ -5,7 +5,6 @@ import sys
|
||||
import configparser
|
||||
from email.utils import parseaddr
|
||||
import email
|
||||
#import MySQLdb
|
||||
import psycopg2
|
||||
|
||||
|
||||
@ -23,10 +22,9 @@ def DBConfig(configfile):
|
||||
return d_dbconfig
|
||||
|
||||
|
||||
def ConnectMysqlDB(dbconfig):
|
||||
def ConnectDB(dbconfig):
|
||||
connstr = f"host={dbconfig['host']} dbname={dbconfig['db']} user={dbconfig['user']} password={dbconfig['passwd']}"
|
||||
conn = psycopg2.connect(connstr)
|
||||
#conn = MySQLdb.connect(**dbconfig)
|
||||
|
||||
return conn, conn.cursor()
|
||||
|
||||
@ -85,7 +83,7 @@ def main():
|
||||
recipient = maildata[1]
|
||||
mailcontent = maildata[2]
|
||||
|
||||
conn, cursor = ConnectMysqlDB(d_dbconfig)
|
||||
conn, cursor = ConnectDB(d_dbconfig)
|
||||
CreateDB(conn, cursor)
|
||||
|
||||
InsertMail(conn, cursor, sender, recipient, mailcontent)
|
||||
|
Loading…
Reference in New Issue
Block a user