Changeset 410


Ignore:
Timestamp:
Jan 27, 2020, 2:25:56 PM (5 years ago)
Author:
g7moreau
Message:
  • Try to push old version of the klask switch map
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r409 r410  
    1414use strict;
    1515use warnings;
    16 use version; our $VERSION = version->declare('0.7.11');
     16use version; our $VERSION = version->declare('0.7.12');
    1717
    1818use Readonly;
  • trunk/push-web

    r408 r410  
    4848
    4949klask exportsw --format dot --modulo ${GRAPH_MODULO} --shift ${GRAPH_SHIFT} > ${TMP}/switch-map.txt.new
    50 
     50klask exportsw                                                              > ${TMP}/switch-db.txt.new
    5151
    5252klask exportdb    > ${TMP}/hostname-db.txt
    53 klask exportsw    > ${TMP}/switch-db.txt
    5453klask ip-free     > ${TMP}/ipfree-db.txt
    5554klask bad-vlan-id > ${TMP}/badvlan-db.txt
    5655
     56cmp --silent ${TMP}/switch-db.txt.new ${TMP}/switch-db.txt || {
     57   mv -f ${TMP}/switch-db.txt.new ${TMP}/switch-db.${TIMEFILE}.txt;
     58   ln -sf ${TMP}/switch-db.${TIMEFILE}.txt ${TMP}/switch-db.txt
     59   }
     60
     61cmp --silent ${TMP}/switch-map.txt.new ${TMP}/switch-map.txt || {
     62   mv -f ${TMP}/switch-map.txt.new ${TMP}/switch-map.${TIMEFILE}.txt;
     63   ln -sf ${TMP}/switch-map.${TIMEFILE}.txt ${TMP}/switch-map.txt
     64   }
     65
     66old_switch_db=$((echo 'command <tt>klask exportsw --format txt</tt>';
     67      (cd ${TMP}/; ls -1 switch-db.20[[0-9]][[0-9]]-[[0-9]][[0-9]]-[[0-9]][[0-9]].[[0-9]][[0-9]]-[[0-9]][[0-9]].txt;) \
     68      | sed -e 's/^switch-db\.//; s/\.txt$//;' \
     69      | xargs -r -I {} printf "<a href=\"switch-db.%s.txt\">%s</a>\n" '{}' '{}' \
     70      ) \
     71   | paste -sd ',' -)
     72
     73old_switch_map=$((echo 'graphviz';\
     74      (cd ${TMP}/; ls -1 switch-map.20[[0-9]][[0-9]]-[[0-9]][[0-9]]-[[0-9]][[0-9]].[[0-9]][[0-9]]-[[0-9]][[0-9]].txt;) \
     75      | sed -e 's/^switch-map\.//; s/\.txt$//;' \
     76      | xargs -r -I {} printf "<a href=\"switch-map.%s.txt\">%s</a>\n" '{}' '{}' \
     77      )\
     78   | paste -sd ',' -)
    5779
    5880cat <<END > ${TMP}/index.html
     
    237259   <ul>
    238260    <li><a href="hostname-db.txt">Computers DB</a> (command <tt>klask exportdb --format txt</tt>),</li>
    239     <li><a href="switch-db.txt">Switches DB</a> (command <tt>klask exportsw --format txt</tt>),</li>
     261    <li><a href="switch-db.txt">Switches DB</a> (${old_switch_db}),</li>
    240262    <li><a href="ipfree-db.txt">IP available</a> (command <tt>klask ip-free --format txt</tt>),</li>
    241263    <li><a href="badvlan-db.txt">VLAN mismatch</a> (command <tt>klask bad-vlan-id --format txt</tt>),</li>
    242     <li>Map format: <a href="switch-map.txt">dot source</a> (graphviz), <a href="switch-map.png">png</a>, <a href="switch-map.svg">svg</a>.</li>
     264    <li>Map format: <a href="switch-map.txt">dot source</a> (${old_switch_map}), <a href="switch-map.png">png</a>, <a href="switch-map.svg">svg</a>.</li>
    243265   </ul>
    244266  </p>
     
    254276</html>
    255277END
    256 
    257 cmp --silent ${TMP}/switch-map.txt.new ${TMP}/switch-map.txt || {
    258    mv -f ${TMP}/switch-map.txt.new ${TMP}/switch-map.${TIMEFILE}.txt;
    259    ln -sf ${TMP}/switch-map.${TIMEFILE}.txt ${TMP}/switch-map.txt
    260    }
    261278
    262279if [ "${REMOTE_SERVER}" = "localhost" ]
     
    269286      ${TMP}/*-db.txt \
    270287      ${TMP}/switch-map.txt \
     288      ${TMP}/*.20[[0-9]][[0-9]]-[[0-9]][[0-9]]-[[0-9]][[0-9]].[[0-9]][[0-9]]-[[0-9]][[0-9]].txt \
    271289      ${REMOTE_FOLDER}/
    272290
     
    283301      ${TMP}/*-db.txt \
    284302      ${TMP}/switch-map.txt \
     303      ${TMP}/*.20[[0-9]][[0-9]]-[[0-9]][[0-9]]-[[0-9]][[0-9]].[[0-9]][[0-9]]-[[0-9]][[0-9]].txt \
    285304      ${REMOTE_USER}@${REMOTE_SERVER}:${REMOTE_FOLDER}/
    286305
Note: See TracChangeset for help on using the changeset viewer.