Hi guys
Having a small problem, I have a file in a skel directory that has to be copped each time a virtual server is created. The file contains several template variables. All of the variables are converted correctly except ${MYSQL_USER}. I noticed in the Template Variable Examples that there could be two methods and I have tried both without success (ignore the quotes below)
when I use “${MYSQL_USER}” I get “${MYSQL_USER}”
when I use “$MYSQL_USER” I get “1_USER”
I have been running further testing and if I add the variable above to the email created at the end of the “Create Virtual Server” process then all template variables are replaced correctly, for their values. It looks like this is a matter of order. Is there another way to get the ${MYSQL_USER} at the skel point in the process?
Thanks Allan
Comments
Submitted by JamieCameron on Fri, 08/27/2010 - 12:57 Comment #1
Ok, the problem here is that the $MYSQL_USER domain variable isn't worked out by Virtualmin until later in the creation process, after the /etc/skel copy has been done. The only work-around currently is to use ${USER} instead, which will be the same unless it is more than 16 characters long.
Submitted by JamieCameron on Fri, 08/27/2010 - 13:01 Comment #2
In the next Virtualmin release (3.81) I will fix this bug so that $MYSQL_USER can be used in skeleton files.
Submitted by AllanIT on Fri, 08/27/2010 - 22:25 Comment #3
Thanks for the advice and thanks for the fix
Allan
Submitted by Issues on Sat, 09/11/2010 - 14:20 Comment #4
Automatically closed -- issue fixed for 2 weeks with no activity.
Submitted by AllanIT on Mon, 11/08/2010 - 00:29 Comment #5
I am posting this here because my next question is continuing this thread.
I note that at
http://www.virtualmin.com/documentation/id%2Ctemplate_variable_listing
it sais that
any custom fields will be available in variables named $FIELD_fieldname
Are custom fields available in skells directory?
And if they are how do I use them because none of the list below work?
$FIELD_fieldname ${FIELD_fieldname} $PARENT_DOMAIN_fieldname ${PARENT_DOMAIN_fieldname} $VIRTUALSERVER_fieldname ${VIRTUALSERVER_fieldname}
Thanks Allan
Submitted by AllanIT on Mon, 11/08/2010 - 00:28 Comment #6
I am posting this here because my next question is continuing this thread.
I note that at
http://www.virtualmin.com/documentation/id%2Ctemplate_variable_listing
it sais that
any custom fields will be available in variables named $FIELD_fieldname
Are custom fields available in skells directory?
And if they are how do I use them because none of the list below work?
$FIELD_fieldname ${FIELD_fieldname} $PARENT_DOMAIN_fieldname ${PARENT_DOMAIN_fieldname} $VIRTUALSERVER_fieldname ${VIRTUALSERVER_fieldname}
Thanks Allan
Submitted by JamieCameron on Mon, 11/08/2010 - 16:46 Comment #7
Yes, they should work fine in files copied from /etc/skel .
Is any template substitution working in those files, like $DOM ? If not, do you have variable substitution enabled ?
Submitted by AllanIT on Mon, 11/08/2010 - 21:39 Comment #8
Is any template substitution working in those files, like $DOM
Yes each of the following are being converted properly.
${DB} ${MYSQL_USER} ${PASS} ${OWNER}
If not, do you have variable substitution enabled ?
If you mean
Virtualmin> System Settings> Server Templates> Select the Templates> Edit template section: Home directory> Substitute variables in contents? Set to Yes
then yes.
Just to make sure I have the concept correct
I goto
Virtualmin> System Customization> Custom Fields>
and create custom fields like NumEmployees then where I want the variable replaced by the value entered when creating the virtual server, I put ${FIELD_NumEmployees} or ${VIRTUALSERVER_NumEmployees} and what I should get is the value entered in the custom field at the time the virtual server was created.
What I am getting is the variables itself.
${FIELD_NumEmployees} ${VIRTUALSERVER_NumEmployees}
Note the other variables that are being replaced correctly are in the same file.
Submitted by JamieCameron on Mon, 11/08/2010 - 23:21 Comment #9
I think I see it .. in the variable, the whole thing needs to be upper case, like
${FIELD_NUMEMPLOYEES}
Submitted by AllanIT on Tue, 11/09/2010 - 09:47 Comment #10
Ahhh!
Yes you are correct. It now works.
Thanks For the help
Allan