Changeset 382


Ignore:
Timestamp:
Mar 22, 2010, 4:28:52 PM (11 years ago)
Author:
lucas
Message:

redmine-find: "cloudify" the script by connecting to the master host

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ror-farm/redmine/redmine-find

    r352 r382  
    1818
    1919# Init
    20 Database="admin_prod"
     20Database="admin_prod"
     21User="rormanager"
    2122RedmineURL="http://admin.ror.bearstech.com"
    2223
     24# Parse MySQL config
     25mysql_user=$(cat /home/$User/.my.cnf | grep "^user" | awk '{print $3}')
     26mysql_pass=$(cat /home/$User/.my.cnf | grep "^pass" | awk '{print $3}')
     27mysql_host="twix9"
     28
    2329# Find the rorette tracker
    24 tracker_id=`echo "SELECT id FROM trackers WHERE name LIKE '%Rorette%';" | mysql $Database -N -B`
     30tracker_id=`echo "SELECT id FROM trackers WHERE name LIKE '%Rorette%';" | mysql $Database -N -B -u$mysql_user -p$mysql_pass -h$mysql_host`
    2531
    2632function usage {
     
    6268if [ -z "$nom" ] && [ -z "$vserve" ] && [ -z "$email" ] && [ -z "$limit" ]
    6369then
    64   ids=`echo "SELECT id FROM issues WHERE tracker_id = $tracker_id AND status_id != 5 AND status_id != 6;" | mysql $Database -N -B`
     70  ids=`echo "SELECT id FROM issues WHERE tracker_id = $tracker_id AND status_id != 5 AND status_id != 6;" | mysql $Database -N -B -u$mysql_user -p$mysql_pass -h$mysql_host`
    6571fi
    6672
     
    7379 then
    7480    echo "| Client name  = $nom"
    75     idNom=`echo "SELECT customized_id FROM custom_values WHERE value LIKE '%$nom%' AND custom_field_id = 1 ;" | mysql $Database -N -B`
     81    idNom=`echo "SELECT customized_id FROM custom_values WHERE value LIKE '%$nom%' AND custom_field_id = 1 ;" | mysql $Database -N -B -u$mysql_user -p$mysql_pass -h$mysql_host`
    7682
    7783    for id in $idNom
     
    8490 then
    8591    echo "| Vserver name = $vserve"
    86     idVserve=`echo "SELECT customized_id FROM custom_values WHERE value LIKE '%$vserve%' AND custom_field_id = 3 ;" | mysql $Database -N -B`
     92    idVserve=`echo "SELECT customized_id FROM custom_values WHERE value LIKE '%$vserve%' AND custom_field_id = 3 ;" | mysql $Database -N -B -u$mysql_user -p$mysql_pass -h$mysql_host`
    8793
    8894    for id in $idVserve
     
    95101 then
    96102    echo "| Client email = $email"
    97     idEmail=`echo "SELECT customized_id FROM custom_values WHERE value LIKE '%$email%' AND custom_field_id = 2 ;" | mysql $Database -N -B`
     103    idEmail=`echo "SELECT customized_id FROM custom_values WHERE value LIKE '%$email%' AND custom_field_id = 2 ;" | mysql $Database -N -B -u$mysql_user -p$mysql_pass -h$mysql_host`
    98104
    99105    for id in $idEmail
     
    113119if [ -n "$nom" ] || [ -n "$vserve" ] || [ -n "$email" ] || [ -n "$limit" ]
    114120then
    115   ids=`echo "$sql ;" | mysql $Database -N -B`
     121  ids=`echo "$sql ;" | mysql $Database -N -B -u$mysql_user -p$mysql_pass -h$mysql_host`
    116122fi
    117123
     
    121127  echo "Issue URL  = $RedmineURL/issues/show/$id"
    122128
    123   id_client=`echo "SELECT author_id FROM issues WHERE id = $id;" | mysql $Database -N -B`
    124   nom_client=`echo "SELECT login FROM users WHERE id = $id_client;" | mysql $Database -N -B`
     129  id_client=`echo "SELECT author_id FROM issues WHERE id = $id;" | mysql $Database -N -B -u$mysql_user -p$mysql_pass -h$mysql_host`
     130  nom_client=`echo "SELECT login FROM users WHERE id = $id_client;" | mysql $Database -N -B -u$mysql_user -p$mysql_pass -h$mysql_host`
    125131  echo "Client     = $nom_client"
    126132 
    127   nomMachine=`echo "SELECT value FROM custom_values WHERE customized_id = $id AND custom_field_id = 1;" | mysql $Database -N -B`
     133  nomMachine=`echo "SELECT value FROM custom_values WHERE customized_id = $id AND custom_field_id = 1;" | mysql $Database -N -B -u$mysql_user -p$mysql_pass -h$mysql_host`
    128134  echo "Rorette    = $nomMachine"
    129135
    130   slices=`echo "SELECT value FROM custom_values WHERE customized_id = $id AND custom_field_id = 4;" | mysql $Database -N -B`
     136  slices=`echo "SELECT value FROM custom_values WHERE customized_id = $id AND custom_field_id = 4;" | mysql $Database -N -B -u$mysql_user -p$mysql_pass -h$mysql_host`
    131137  echo "Slices     = $slices"
    132138
    133   template=`echo "SELECT value FROM custom_values WHERE customized_id = $id AND custom_field_id = 5;" | mysql $Database -N -B`
     139  template=`echo "SELECT value FROM custom_values WHERE customized_id = $id AND custom_field_id = 5;" | mysql $Database -N -B -u$mysql_user -p$mysql_pass -h$mysql_host`
    134140  if echo $template | grep -qF "1.9.1" ; then
    135141    template="template-lenny19"
     
    139145  echo "Template   = $template"
    140146
    141   ssh_keys=`echo "SELECT disk_filename FROM attachments WHERE container_id = $id AND container_type = 'Issue';" | mysql $Database -N -B`
     147  ssh_keys=`echo "SELECT disk_filename FROM attachments WHERE container_id = $id AND container_type = 'Issue';" | mysql $Database -N -B -u$mysql_user -p$mysql_pass -h$mysql_host`
    142148  full_ssh_cmd=""
    143149  for k in $ssh_keys; do
Note: See TracChangeset for help on using the changeset viewer.