Enable logging in Mercurial bugzilla extension scripts - mercurial

In Mercurial, how I can enable the logging in bugzilla extension scripts? e.g. the "self.ui.note" inside the bugzilla.py.
host = self.ui.config('bugzilla', 'host', 'localhost')
user = self.ui.config('bugzilla', 'user', 'bugs')
passwd = self.ui.config('bugzilla', 'password')
db = self.ui.config('bugzilla', 'db', 'bugs')
timeout = int(self.ui.config('bugzilla', 'timeout', 5))
self.ui.note(_('connecting to %s:%s as %s, password %s\n') %***
(host, db, user, '*' * len(passwd)))
self.conn = bzmysql._MySQLdb.connect(host=host,
user=user, passwd=passwd,
db=db,
connect_timeout=timeout)
self.cursor = self.conn.cursor()
self.longdesc_id = self.get_longdesc_id()
self.user_ids = {}
self.default_notify = "cd %(bzdir)s && ./processmail %(id)s %(user)s"

I'm not sure it will do what you want since I don't have time to look in the source. But you should try one of the following command line parameters :
-v, --verbose
enable additional output
--debug
enable debugging output

Related

Problems with execution aws command via ssh jenkins

Good morning, how are you?
I have a problem with one execution via ssh in my jenkins.
Those characters that appear before did not appear, and we have not changed anything in the node..
The code we use is:
withCredentials([usernamePassword(credentialsId: 'id', passwordVariable: 'pass', usernameVariable: 'user')]) {
def remote = [:]
remote.name = 'id_nme'
remote.host = 'ip_node'
remote.user = user
remote.password = pass
remote.allowAnyHosts = true
remote.timeoutSec = 300
sshCommand remote: remote, command: "aws autoscaling describe-auto-scaling-groups --auto-scaling-group-name [name_asg]"
}
When the command is launched, the job is stuck and does not progress.

Config Error : I'm unable to connect my DB using Moodle

Error: Database connection failed
It is possible that the database is overloaded or otherwise not running properly.
The site administrator should also check that the database details have been correctly specified in config.php
Below My Config.php
unset($CFG);
global $CFG;
$CFG = new stdClass();
$CFG->dbtype = 'mariadb';
$CFG->dblibrary = 'native';
$CFG->dbhost = '192.0.0.0';
$CFG->dbname = 'moodle';
$CFG->dbuser = 'root';
$CFG->dbpass = 'admindb#123';
$CFG->prefix = 'mdl_';
$CFG->dboptions = array (
'dbpersist' => 0,
'dbport' => 3306,
'dbsocket' => '',
'dbcollation' => 'utf8mb4_general_ci',
);
$CFG->wwwroot = 'http://192.0.0.0/moodle-apexon';
$CFG->dataroot = 'C://xampp//moodledata';
$CFG->admin = 'admin';
Try connecting to the database via the command line. If that doesn't work then check the username, password, dbname etc.
mysql --user=root --password=admindb#123 --host=192.0.0.0 moodle

SMTP configuration on Plesk Server (Centos)

I'm trying to make code to send a simple mail via SMTP, I read that I must use the class phpmailer and also install pear engine on the server root, I downloaded some different files to authenticate the SMTP but always requires more files that I don't have or cant be charged. Actually, the PHP errors display this:
Warning: require_once(): open_basedir restriction in effect. File(/opt/plesk/php/7.1/share/pear/PEAR.php) is not within the allowed path(s): (/var/www/vhosts/necotec.es/:/tmp/) in /var/www/vhosts/necotec.es/httpdocs/prueba_smtp/Mail.php on line 48
Warning: require_once(/opt/plesk/php/7.1/share/pear/PEAR.php): failed to open stream: Operation not permitted in /var/www/vhosts/necotec.es/httpdocs/prueba_smtp/Mail.php on line 48
Fatal error: require_once(): Failed opening required 'PEAR.php' (include_path='.:/opt/plesk/php/7.1/share/pear') in /var/www/vhosts/necotec.es/httpdocs/prueba_smtp/Mail.php on line 48
I dont know if cant be found or is a permision problem the files by default takes 644 permisions in this server. Any clue would be helpfull thanks.
open_basedir restriction in effect
error means that some files or scripts are located out of allowed directory.
In your case this file is /opt/plesk/php/7.1/share/pear/PEAR.php.
In Plesk you can disable open_basedir(not secure): Domains > example.com > PHP Settings and set open_basedir to none.
Another way(more secure) is to set open_basedir as {WEBSPACEROOT}{/}{:}{TMP}{/}:/opt/plesk/php/7.1
I was able to configure PHPMailer on my test server(Plesk 17.5-17.8) using steps:
Logged in to the server using SSH
Went to domain Document root directory: # cd /var/www/vhosts/example.com/httpdocs/
Run the command taken from github: # composer require phpmailer/phpmailer
As a result "vendor" folder appeared in "httpdocs" folder.
Created a testmail.php file based on 0-send-email-plesk.php:
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
//Load Composer's autoloader
require 'vendor/autoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2; # 0 off, 1 client, 2 client y server
$mail->CharSet = 'UTF-8';
$mail->Host = 'localhost';
$mail->Port = 25;
$mail->SMTPSecure = 'tls'; # SSL is deprecated
$mail->SMTPOptions = array (
'ssl' => array(
'verify_peer' => true,
'verify_depth' => 3,
'allow_self_signed' => true,
'peer_name' => 'Plesk',
)
);
$mail->SMTPAuth = true;
$mail->Username = 'sender#example.com';
$mail->Password = 'password';
$mail->setFrom('sender#example.com', 'Name Surname');
$mail->addAddress('recipient#domain.tld', 'Name Surname');
$mail->Subject = 'Email subject';
$mail->msgHTML('Email content with <strong>html</strong>');
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
It assumes that local mail server is used and Default Plesk self signed certificate is used by mail server: Plesk > Tools & Settings > SSL/TLS Certificates > Certificate for securing mail

Getting "Server Error" when click on "New Account" in gerrit

I am getting server error when i am try to register new user at first time. It works fine if i configure with H2 database.
My gerrit.config file is :
[gerrit]
basePath = git
canonicalWebUrl = http://localhost:8081
[database]
type = mysql
database = reviewdb
hostname = localhost
username = gerrit
[index]
type = LUCENE
[auth]
type = DEVELOPMENT_BECOME_ANY_ACCOUNT
[sendemail]
smtpServer = localhost
[container]
user = gerrit
javaHome = /usr/lib/jvm/java-7-openjdk-amd64/jre
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = http://*:8081/
[cache]
directory = cache

PHP5-FPM and MYSQL

I'm using lighttpd and pfp-fpm.
All work correctly, but if I call a mysql_connect() on my php scripts I get an empty page.
Like a "denied operation".
This is my php-fpm.conf pool
[example.com]
listen = 127.0.0.1:9001
listen.backlog = -1
user = example.com
group = example.com
pm = dynamic
pm.max_requests = 0
pm.max_children = 2
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 1
chroot = /home/vhosts/example.com/
request_terminate_timeout = 2
request_slowlog_timeout = 1
slowlog = /home/vhosts/example.com/log/php-slow.log
catch_workers_output = yes
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
This is my lighttpd vhost:
$HTTP["host"] =~ "(^|.)example\.com$" {
server.document-root = "/home/vhosts/example.com/web"
server.errorlog = "/home/vhosts/example.com/log/error.log"
accesslog.filename = "/home/vhosts/example.com/log/access.log"
fastcgi.server = (
".php" => (
"localhost" => (
"docroot" => "/web",
"host" => "127.0.0.1",
"port" => "9001"
)
)
)
}
What is wrong? If I don't use mysql I can see the result of the php script correctly.
Turning on error display and posting those errors would be helpful, but since you can use mysql without chrooting php, I guess you are getting some connection error, since php tries to connect to mysql on localhost using socket ( php compiled with --with-mysql-sock=/var/mysql.sock), and most likely this socket is outside your chrooted environment.
You can try:
Recompiling php to not use socket
creating hard link to socket in your chrooted path
using some internal ip (like 10.0.0.1,192.168.0.1) instead of loopback
Seems to me all the problems are because of the user and group being example.com
i guess that user doesnt have rights to perform the requested tasks