ispCP - Board - Support
trunk (post rc4, pre rc5) problems (bad parts templates?) - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Development Area (/forum-1.html)
+--- Forum: General discussion (/forum-11.html)
+--- Thread: trunk (post rc4, pre rc5) problems (bad parts templates?) (/thread-3190.html)



trunk (post rc4, pre rc5) problems (bad parts templates?) - ispcomm - 05-03-2008 02:56 AM

Hi all,

I decided to give it a go on a *clean* debian (etch) installation. Installs, no warnings and mysql/panel/fastcgi/php5 etc etc all is ok.

However... when creating a new domain under (I do this under a test reseller) it seems ispcp-dmn-mngr cannot find some pieces.

The domain is left in "error" state with the following error: repl_tag() | ERROR: Undefined template replacement data in repl_var: {APACHE_WWW_DIR}!

A more detailed look at the logs reveals this (I removed irrelevant lines to keep it short):
Code:
DEBUG: push_el() sub_name: dmn_mngr_engine(), msg: proceeding -> SELECT t1.domain_id, t1.domain_name, t1.domain_gid, t1.domain_uid, t1.domain_admin_id,
    t1.domain_created_id, t1.domain_created, t1.domain_last_modified, t1.domain_mailacc_limit, t1.domain_ftpacc_limit,
    t1.domain_traffic_limit, t1.domain_sqld_limit, t1.domain_sqlu_limit, t1.domain_status, t1.domain_alias_limit,
    t1.domain_subd_limit, t1.domain_ip_id, t1.domain_disk_limit, t1.domain_disk_usage, t1.domain_php,
    t1.domain_cgi, t2.ip_number FROM domain AS t1, server_ips AS t2 WHERE t1.domain_ip_id = t2.ip_id
    AND t1.domain_id = 1
DEBUG: push_el() sub_name: dmn_add_data(), msg: Starting...
DEBUG: push_el() sub_name: dmn_add_awstats_data(), msg: Starting...
DEBUG: push_el() sub_name: dmn_add_awstats_cfg_data(), msg: Starting...
DEBUG: push_el() sub_name: get_tpl(), msg: Starting...
DEBUG: push_el() sub_name: get_file(), msg: Starting...
DEBUG: push_el() sub_name: get_file(), msg: Ending...
DEBUG: push_el() sub_name: get_tpl(), msg: Ending...
DEBUG: push_el() sub_name: prep_tpl(), msg: Starting...
DEBUG: push_el() sub_name: repl_var(), msg: Starting...
DEBUG: push_el() sub_name: repl_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Ending...
DEBUG: push_el() sub_name: repl_tag(), msg: Ending...
DEBUG: push_el() sub_name: repl_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: ERROR: '{AWSTATS_ENGINE_DIR}' eq '{AWSTATS_ENGINE_DIR}', missing '{AWSTATS_ENGINE_DIR}' in src !
DEBUG: push_el() sub_name: repl_var(), msg: Ending...
DEBUG: push_el() sub_name: repl_var(), msg: Starting...
DEBUG: push_el() sub_name: repl_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Ending...
DEBUG: push_el() sub_name: repl_tag(), msg: Ending...
DEBUG: push_el() sub_name: repl_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: ERROR: '{APACHE_LOG_DIR}' eq '{APACHE_LOG_DIR}', missing '{APACHE_LOG_DIR}' in src !
DEBUG: push_el() sub_name: repl_var(), msg: Ending...
DEBUG: push_el() sub_name: repl_var(), msg: Starting...
DEBUG: push_el() sub_name: repl_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Ending...
DEBUG: push_el() sub_name: repl_tag(), msg: Ending...
DEBUG: push_el() sub_name: repl_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: ERROR: '{AWSTATS_WEB_DIR}' eq '{AWSTATS_WEB_DIR}', missing '{AWSTATS_WEB_DIR}' in src !
DEBUG: push_el() sub_name: repl_var(), msg: Ending...
DEBUG: push_el() sub_name: repl_var(), msg: Starting...
DEBUG: push_el() sub_name: repl_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Ending...
DEBUG: push_el() sub_name: repl_tag(), msg: Ending...
DEBUG: push_el() sub_name: repl_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: ERROR: '{AWSTATS_CACHE_DIR}' eq '{AWSTATS_CACHE_DIR}', missing '{AWSTATS_CACHE_DIR}' in src !
DEBUG: push_el() sub_name: repl_var(), msg: Ending...
DEBUG: push_el() sub_name: repl_var(), msg: Starting...
DEBUG: push_el() sub_name: repl_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Ending...
DEBUG: push_el() sub_name: repl_tag(), msg: Ending...
DEBUG: push_el() sub_name: repl_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Ending...
DEBUG: push_el() sub_name: repl_tag(), msg: Ending...
DEBUG: push_el() sub_name: repl_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Ending...
DEBUG: push_el() sub_name: repl_tag(), msg: Ending...
DEBUG: push_el() sub_name: repl_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Ending...
DEBUG: push_el() sub_name: repl_tag(), msg: Ending...
DEBUG: push_el() sub_name: repl_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: ERROR: '{DOMAIN_NAME}' eq '{DOMAIN_NAME}', missing '{DOMAIN_NAME}' in src !
DEBUG: push_el() sub_name: repl_var(), msg: Ending...
DEBUG: push_el() sub_name: prep_tpl(), msg: Ending...
DEBUG: push_el() sub_name: store_file(), msg: Starting...
DEBUG: push_el() sub_name: setfmode(), msg: Starting...
DEBUG: push_el() sub_name: setfmode(), msg: Ending...
DEBUG: push_el() sub_name: store_file(), msg: Ending...
DEBUG: push_el() sub_name: dmn_add_awstats_cfg_data(), msg: Ending...
DEBUG: push_el() sub_name: dmn_add_awstats_cron(), msg: Starting...
DEBUG: push_el() sub_name: doSQL(), msg: Starting...
DEBUG: push_el() sub_name: doSQL(), msg: Ending...
DEBUG: push_el() sub_name: get_tpl(), msg: Starting...
DEBUG: push_el() sub_name: get_file(), msg: Starting...
DEBUG: push_el() sub_name: get_file(), msg: Ending...
DEBUG: push_el() sub_name: get_file(), msg: Starting...
DEBUG: push_el() sub_name: get_file(), msg: Ending...
DEBUG: push_el() sub_name: get_file(), msg: Starting...
DEBUG: push_el() sub_name: get_file(), msg: Ending...
DEBUG: push_el() sub_name: get_tpl(), msg: Ending...
DEBUG: push_el() sub_name: prep_tpl(), msg: Starting...
DEBUG: push_el() sub_name: repl_var(), msg: Starting...
DEBUG: push_el() sub_name: repl_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: ERROR: '{AWSTATS_ROOT_DIR}' eq '{AWSTATS_ROOT_DIR}', missing '{AWSTATS_ROOT_DIR}' in src !
DEBUG: push_el() sub_name: repl_var(), msg: Ending...
DEBUG: push_el() sub_name: repl_var(), msg: Starting...
DEBUG: push_el() sub_name: repl_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: ERROR: '{AWSTATS_ENGINE_DIR}' eq '{AWSTATS_ENGINE_DIR}', missing '{AWSTATS_ENGINE_DIR}' in src !
DEBUG: push_el() sub_name: repl_var(), msg: Ending...
DEBUG: push_el() sub_name: repl_var(), msg: Starting...
DEBUG: push_el() sub_name: repl_tag(), msg: Starting...
DEBUG: push_el() sub_name: repl_tag(), msg: ERROR: Undefined template replacement data in repl_var: {APACHE_WWW_DIR}!
DEBUG: pop_el() sub_name: repl_tag(), msg: ERROR: Undefined template replacement data in repl_var: {APACHE_WWW_DIR}!
DEBUG: push_el() sub_name: doSQL(), msg: Starting...
DEBUG: push_el() sub_name: doSQL(), msg: Ending...
DEBUG: push_el() sub_name: dmn_mngr_engine(), msg: Ending...
DEBUG: push_el() sub_name: dmn_mngr_shut_down(), msg: Starting...
DEBUG: push_el() sub_name: dmn_mngr_shut_down(), msg: Ending...

The query returns a proper domain row with correct name, ip address, parameters etc. It seems that some variables from the templates are not found.

For example DOMAIN_NAME that the mngr is looking at is in reality DMN_NAME in the templates.

That is:
Code:
# cd /etc/ispcp/apache/parts ; grep DMN_NAME * -l
als_cgi_entry.tpl
als_entry.tpl
als_php2_entry.tpl
dg_entry.tpl
dmn_awstats_dynamic_entry.tpl
dmn_awstats_static_entry.tpl
dmn_b.tpl
dmn_cgi_entry.tpl
dmn_entry.tpl
dmn_e.tpl
dmn_php2_entry.tpl
sub_cgi_entry.tpl
sub_entry.tpl
sub_php2_entry.tpl
and
Code:
#grep DOMAIN_NAME *
#
Or perhaps I'm in the wrong direction and I should be looking at ispcp.conf ???
I have AWSTATS there:
Code:
# grep AWSTATS /etc/ispcp/ispcp.conf
# AWSTATS data
AWSTATS_ACTIVE = yes
AWSTATS_MODE = 1
AWSTATS_CACHE_DIR = /var/cache/awstats
AWSTATS_CONFIG_DIR = /etc/awstats
AWSTATS_ENGINE_DIR = /usr/lib/cgi-bin
AWSTATS_WEB_DIR = /usr/share/awstats
AWSTATS_ROOT_DIR = /var/www/ispcp/engine/awstats
Also /etc/ispcp/apache/working/ispcp.conf is there (virgin... not a single domain in there, ony the usual mod_rewrite, mod_cband and Logformat stuff).

Any ideas before I dig further???

ispcomm


RE: trunk (post rc4, pre rc5) problems (bad parts templates?) - ispcomm - 05-03-2008 03:17 AM

I should add some more debugging info (modded ispcp_common-methods) to show some info:
Code:
DEBUG: push_el() sub_name: get_tag(), msg: ERROR: '{DOMAIN_NAME}' eq '{DOMAIN_NAME}', missing '{DOMAIN_NAME}' in src !
DEBUG: push_el() sub_name: repl_var(), msg: Ending...
DEBUG: push_el() sub_name: prep_tpl(), msg: Ending...
DEBUG: push_el() sub_name: store_file(), msg: Starting...
DEBUG: push_el() sub_name: setfmode(), msg: Starting...
DEBUG: push_el() sub_name: setfmode(), msg: Ending...
DEBUG: push_el() sub_name: store_file(), msg: Ending...
DEBUG: push_el() sub_name: dmn_add_awstats_cfg_data(), msg: Ending...
DEBUG: push_el() sub_name: dmn_add_awstats_cron(), msg: Starting...
DEBUG: push_el() sub_name: doSQL(), msg: Starting...
DEBUG: push_el() sub_name: doSQL(), msg: Ending...
DEBUG: push_el() sub_name: get_tpl(,,), msg: Starting...
DEBUG: push_el() sub_name: get_file(/etc/ispcp/cron.d/parts/dmn_awstats_b.tpl), msg: Starting...
DEBUG: push_el() sub_name: get_file(), msg: Ending...
DEBUG: push_el() sub_name: get_file(/etc/ispcp/cron.d/parts/dmn_awstats_entry.tpl), msg: Starting...
DEBUG: push_el() sub_name: get_file(), msg: Ending...
DEBUG: push_el() sub_name: get_file(/etc/ispcp/cron.d/parts/dmn_awstats_e.tpl), msg: Starting...
DEBUG: push_el() sub_name: get_file(), msg: Ending...
DEBUG: push_el() sub_name: get_tpl(), msg: Ending...
DEBUG: push_el() sub_name: prep_tpl(), msg: Starting...
DEBUG: push_el() sub_name: repl_var(), msg: Starting...
DEBUG: push_el() sub_name: repl_tag({AWSTATS_ROOT_DIR},{AWSTATS_ROOT_DIR},# [{DMN_NAME}] AWStats static tasks START.,/var/www/ispcp/engine/awstats,repl_var: {AWSTATS_ROOT_DIR}), msg: Starting...
DEBUG: push_el() sub_name: get_tag({AWSTATS_ROOT_DIR},{AWSTATS_ROOT_DIR},# [{DMN_NAME}] AWStats static tasks START.), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: ERROR: '{AWSTATS_ROOT_DIR}' eq '{AWSTATS_ROOT_DIR}', missing '{AWSTATS_ROOT_DIR}' in src !
DEBUG: push_el() sub_name: repl_var(), msg: Ending...
DEBUG: push_el() sub_name: repl_var(), msg: Starting...
DEBUG: push_el() sub_name: repl_tag({AWSTATS_ENGINE_DIR},{AWSTATS_ENGINE_DIR},# [{DMN_NAME}] AWStats static tasks START.,/usr/lib/cgi-bin,repl_var: {AWSTATS_ENGINE_DIR}), msg: Starting...
DEBUG: push_el() sub_name: get_tag({AWSTATS_ENGINE_DIR},{AWSTATS_ENGINE_DIR},# [{DMN_NAME}] AWStats static tasks START.), msg: Starting...
DEBUG: push_el() sub_name: get_tag(), msg: ERROR: '{AWSTATS_ENGINE_DIR}' eq '{AWSTATS_ENGINE_DIR}', missing '{AWSTATS_ENGINE_DIR}' in src !
DEBUG: push_el() sub_name: repl_var(), msg: Ending...
DEBUG: push_el() sub_name: repl_var(), msg: Starting...
DEBUG: push_el() sub_name: repl_tag({APACHE_WWW_DIR},{APACHE_WWW_DIR},# [{DMN_NAME}] AWStats static tasks START.,,repl_var: {APACHE_WWW_DIR}), msg: Starting...
DEBUG: push_el() sub_name: repl_tag(), msg: ERROR: Undefined template replacement data in repl_var: {APACHE_WWW_DIR}!
DEBUG: pop_el() sub_name: repl_tag(), msg: ERROR: Undefined template replacement data in repl_var: {APACHE_WWW_DIR}!
DEBUG: push_el() sub_name: doSQL(), msg: Starting...
DEBUG: push_el() sub_name: doSQL(), msg: Ending...
DEBUG: push_el() sub_name: dmn_mngr_engine(), msg: Ending...
DEBUG: push_el() sub_name: dmn_mngr_shut_down(), msg: Starting...
DEBUG: push_el() sub_name: dmn_mngr_shut_down(), msg: Ending...
This points me to AWSTATS which I have selected to generate as "static" and not dynamic. Could this be the problem (i.e. bad awstats.conf template)?

ispcomm


RE: trunk (post rc4, pre rc5) problems (bad parts templates?) - Cube - 05-03-2008 03:48 AM

Nutzt du Revision 1128 oder neuer? Dann liegt das wohl an den Ă„nderungen am Cron-Template in Changeset 1128.
Machst du ein Ticket auf?


RE: trunk (post rc4, pre rc5) problems (bad parts templates?) - ispcomm - 05-03-2008 07:10 AM

Cube Wrote:Nutzt du Revision 1128 oder neuer? Dann liegt das wohl an den Ă„nderungen am Cron-Template in Changeset 1128.
Machst du ein Ticket auf?
Sorry for not speaking german. I tried translating with babelfish...

The release is the last one (R1132) and my templates are exactly the same as in the repository (default install). I have not opened a ticket because I would like to be sure it's a problem with ispcp first (versus a problem on my side).

I think the error is here:

Code:
DEBUG: push_el() sub_name: repl_var({APACHE_WWW_DIR},# [{DMN_NAME}] AWStats static tasks START.,), msg: Starting...

In the repl_var(var,src,rwith) is called with VAR=APACHE_WWW_DIR, SRC=the file and rwith is EMPTY. This means it's not read from /etc/ispcp/ispcp.conf

now I have to find out where the variables are read from because my ispcp.conf contains it:
Code:
# grep APACHE_WWW_DIR /etc/ispcp/ispcp.conf
APACHE_WWW_DIR = /var/www/virtual



RE: trunk (post rc4, pre rc5) problems (bad parts templates?) - ispcomm - 05-03-2008 07:42 AM

Ok, I have found the error (I think).

In static mode, awstats should put statistics in {APACHE_WWW_DIR}/{DMN_DIR}/statistics

The template /etc/ispcp/cron.d/parts/dmn_awstats_entry.tpl is correct:
Code:
{MINUTE} {HOUR}  * * *   root perl {AWSTATS_ROOT_DIR}/awstats_buildstaticpages.pl -config={DMN_NAME} -update -lang={USER_LANG} -awstatsprog={AWSTATS_ENGINE_DIR}/awstats.pl -dir={APACHE_WWW_DIR}/{DMN_NAME}/statistics/ >/dev/null 2>&1

The problem is in ispcp-dmn-mngr in dmn_add_awstats_cron().

This function loads AWSTATS_WWW_DIR (which is not defined in ispcp.conf) instead of AWSTATS_WEB_DIR.

Since this is confusing (APACHE_WWW_DIR vs AWSTATS_WEB_DIR in ispcp.conf) and WWW_DIR for APACHE_WWW_DIR, APACHE_WWW_DIR for AWSTATS_WWW|WEB_DIR etc in ispcp-dmn-mngr, I think a dev should get this stuff right.

For testing, I changed the tag_hash table as follows:
Code:
my %tag_hash = (
                    '{DMN_NAME}' => $dmn_name,
                    '{MINUTE}' => $cronjob_minute,
                    '{HOUR}' => $cronjob_hour,
                    '{AWSTATS_ROOT_DIR}' => $awstats_root_dir,
                    '{AWSTATS_ENGINE_DIR}' => $awstats_engine_dir,
                    '{APACHE_WWW_DIR}' => $main::cfg{'APACHE_WWW_DIR'},
                    '{USER_LANG}' => $user_lang
                   );
And got my test domain to be created properly... but I'm not sure if I have introduced other problems (perhaps with dynamic awstats).

If someone knows how to open a ticket... pls. do so (as I'm a little tired tonight).

ispcomm.


RE: trunk (post rc4, pre rc5) problems (bad parts templates?) - RatS - 05-03-2008 08:19 AM

I'm glad your found it, your are right. My main problem is, I'm working late at night on ispCP and I'm not that awake I sould be. I fixed it in r1135 do not open a ticket unless it won't work. It will not affect dynamic AWStats.


RE: trunk (post rc4, pre rc5) problems (bad parts templates?) - ispcomm - 05-04-2008 04:29 AM

RatS Wrote:I'm glad your found it, your are right. My main problem is, I'm working late at night on ispCP and I'm not that awake I sould be. I fixed it in r1135 do not open a ticket unless it won't work. It will not affect dynamic AWStats.
I saw your changes and I think it will work now. I'm setting up the test server better so I can follow development. Will test and report back soon.

ispcomm


RE: trunk (post rc4, pre rc5) problems (bad parts templates?) - ispcomm - 05-05-2008 03:35 AM

RatS,

I can confirm that your patches in r1135 are OK. It took me a little more time than expected because r1135 build has a bug during installation and won't install on a clean system (I have opened a ticket http://www.isp-control.net/ispcp/ticket/1230 about this).

Thank you,
ispcomm