CiscoDevNet / devnet-express-dna-issues

Suggested changes to the content of the learning labs for Devnet Express for DNA
Apache License 2.0
6 stars 2 forks source link

dCloud: Issues in Ubuntu Host #41

Closed armartirosyan closed 7 years ago

armartirosyan commented 7 years ago

Ubuntu host in Cisco DevNet Express DNA Sandbox v2 pod has several issues and needs to be re-imaged. Issues are:

  1. devnet-express-code-samples folder shows contents of iss47 branch. Also there are some uncommitted items in that folder so making a pull request ends with error
  2. Main user's home directory (/home/cisco/) has a .ngrok folder which needs to be removed. It prevents multiple ngrok instance from running.
  3. bash script in rc.local file needs a minor change.
    
    USER=cisco
    BASHRC=/home/$USER/.bashrc
    CODE=/home/$USER/Code/devnet-express-code-samples

cp /home/$USER/.bashrc.bak /home/$USER/.bashrc

if cd $CODE && git pull; then logger "git pull succeeded" echo 'echo -e "Code-Samples were successfully updated.\n"' >>$BASHRC echo 'echo -e "Navigate to '$CODE' and start coding.\n"' >>$BASHRC else logger "git pull failed" echo 'echo -e "Sorry, but the system was not able to update the code-samples.\n"' >>$BASHRC echo 'echo -e "To manually pull the latest code-samples, please navigate to the \"'$CODE'\" folder and type \"git pull\"\n"' >>$BASHRC fi

exit 0

ecorban commented 7 years ago

i will work on this issue with armen and update an share i have running on dcloud in SJ. This will need an revision and need to be re-published.

armartirosyan commented 7 years ago

Eddie,

Please use below steps to fix the issues on the Ubuntu host and make adjustments on Windows machine.

  1. Open LXTerminal and navigate to /home/cisco/Code folder

  2. Remove the code-samples folder by using following command sudo rm -rf devnet-express-code-samples

  3. Clone the repository to Code folder by using git clone https://www.github.com/CiscoDevNet/devnet-express-code-samples.git command

  4. After cloning, the folder structure should look like this

    (mycode) cisco@ubuntu:~/Code$ pwd
    /home/cisco/Code
    (mycode) cisco@ubuntu:~/Code$ ll
    total 20
    drwxrwxr-x  5 cisco cisco 4096 May 18 18:09 ./
    drwxr-xr-x 26 cisco cisco 4096 May 18 18:04 ../
    drwxr-xr-x 13 cisco cisco 4096 May 18 18:09 devnet-express-code-samples/
    drwxrwxr-x  7 cisco cisco 4096 Oct 14  2016 mycode/
    drwxrwxr-x  6 cisco cisco 4096 Oct 17  2016 virl-utils/
  5. Replace contents of the rc.local file located in /etc folder with below script

    USER=cisco
    BASHRC=/home/$USER/.bashrc
    CODE=/home/$USER/Code/devnet-express-code-samples
    
    cp /home/$USER/.bashrc.bak /home/$USER/.bashrc
    
    if cd $CODE && git pull; then
      logger "git pull succeeded"
      echo 'echo -e "Code-Samples were successfully updated.\\n"' >>$BASHRC
      echo 'echo -e "Navigate to '$CODE' and start coding.\\n"' >>$BASHRC 
    else
      logger "git pull failed. Make a fresh clone of a repository"
      rm -rf $CODE
      cd /home/$USER/Code &&  git clone https://www.github.com/CiscoDevNet/devnet-express-code-samples.git  
      echo 'echo -e "Code-Samples were successfully updated.\\n"' >>$BASHRC
      echo 'echo -e "Navigate to '$CODE' and start coding.\\n"' >>$BASHRC 
    fi 
    chown -R cisco:cisco $CODE
    
    exit 0
  6. Remove .ngrok2 folder from user's home directory using sudo rm -rf .ngrok2/ command.

  7. Install flask module by using pip install flask and pip3 install flask commands

Please make following changes on the Windows machine as well.

  1. Open Notepad text editor and use Ctrl+O shortcut keys to open a file. Type git-pull.bat and click Open

    image

  2. Change the contents of the file with below commands

    @echo off
    cd "C:\Users\Administrator.WKST1\Code\" && rmdir /s /q devnet-express-code-samples && git clone https://github.com/CiscoDevNet/devnet-express-code-samples.git >> pull_log.txt
  3. Open Use me as a Terminal terminal and install flask module by using pip install flask and pip3 install flask commands.

    image

  4. Open Windows CMD and install flask using commands mentioned in step 3.

    image

    Note: The difference between steps 3 and 4 is virtual environment (venv) and global site-packages directory for python

Above steps should fix all issues we have noticed with Ubuntu and Windows machines.

Please let me know if you have any questions.

Thanks, Armen

ecorban commented 7 years ago

hi armen. thanks for the capturing the information. all are updated from yesterday.

austinMarcos commented 7 years ago

@yawming can you test the following 2 missions from the DNA track to see if the pod image is now working. Make sure that the 3 issues reported above are fixed.

You might need to check out the pre-event setup to make sure you have access to the Ubuntu host in the dCloud pod: https://learninglabs.cisco.com/tracks/devnet-express-dna/00-pre-event-preparation/00-prep-01-prep-before-you-go/step/1

yawming commented 7 years ago
  1. devnet-express/labs/06-dmi-05-mission/1.md @ line 28 module06/lab05_mission need to change to LM-4602/05-mission

  2. I ran script "01_get_interface_stats.py" in Ubuntu. Script itself is ok but got some environment issue - module not found.

(mycode) cisco@ubuntu:~/devnet-express-code-samples/LM-4602/05-mission$ python3 01_get_interface_stats.py Traceback (most recent call last): File "01_get_interface_stats.py", line 8, in import xmltodict ImportError: No module named 'xmltodict' (mycode) cisco@ubuntu:~/devnet-express-code-samples/LM-4602/05-mission$ pip3 install xmltodict Collecting xmltodict Downloading xmltodict-0.11.0-py2.py3-none-any.whl Installing collected packages: xmltodict Successfully installed xmltodict-0.11.0 You are using pip version 8.1.2, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. (mycode) cisco@ubuntu:~/devnet-express-code-samples/LM-4602/05-mission$ pip install xmltodict Requirement already satisfied (use --upgrade to upgrade): xmltodict in /home/cisco/Code/mycode/lib/python3.4/site-packages You are using pip version 8.1.2, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. (mycode) cisco@ubuntu:~/devnet-express-code-samples/LM-4602/05-mission$ pip install --upgrade pip Collecting pip Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB) 100% Installing collected packages: pip Found existing installation: pip 8.1.2 Uninstalling pip-8.1.2: Successfully uninstalled pip-8.1.2 Successfully installed pip-9.0.1

austinMarcos commented 7 years ago

Corrected item 1 from comment above:

devnet-express/labs/06-dmi-05-mission/1.md @ line 28
module06/lab05_mission need to change to LM-4602/05-mission

I published the updated mission to stage and prod.

austinMarcos commented 7 years ago

Delivered as part of v2.1.