Projet

Général

Profil

OSC » Historique » Version 16

Gérald Schwartzmann, 15/01/2016 12:10

1 1 Klaas TJEBBES
h1. OSC
2 1 Klaas TJEBBES
3 3 Klaas TJEBBES
OSC est un script permettant de se connecter aux machines virtuelles OpenNebula avec un client lourd VNC (ssvncviewer).
4 3 Klaas TJEBBES
5 3 Klaas TJEBBES
6 4 Klaas TJEBBES
Installer ssvncviewer, python-gevent et python-websocket :
7 1 Klaas TJEBBES
<pre>
8 12 Klaas TJEBBES
# apt-get install -y ssvnc python-gevent python-websocket python-bs4 python-requests
9 6 Gérald Schwartzmann
</pre>
10 6 Gérald Schwartzmann
11 7 Gérald Schwartzmann
Télécharger le script OSC et le rendre exécutable :
12 2 Klaas TJEBBES
<pre>
13 8 Gérald Schwartzmann
$ wget https://raw.githubusercontent.com/baby-gnu/one-sunstone-rest-client/master/osc
14 8 Gérald Schwartzmann
$ chmod +x osc
15 2 Klaas TJEBBES
</pre>
16 1 Klaas TJEBBES
17 4 Klaas TJEBBES
Créer le fichier d'authentification :
18 2 Klaas TJEBBES
<pre>
19 8 Gérald Schwartzmann
$ mkdir ~/.one/
20 8 Gérald Schwartzmann
$ vi ~/.one/one_auth
21 2 Klaas TJEBBES
</pre>
22 1 Klaas TJEBBES
23 1 Klaas TJEBBES
Contenu du fichier _~/.one/one_auth_ :
24 2 Klaas TJEBBES
<pre>
25 2 Klaas TJEBBES
 <LOGIN_NEBULA>:<PASSWORD_NEBULA>
26 2 Klaas TJEBBES
</pre>
27 1 Klaas TJEBBES
28 5 Klaas TJEBBES
Exécuter la commande interactive :
29 2 Klaas TJEBBES
<pre>
30 11 Gérald Schwartzmann
$ python osc --url http://one.eole.lan/
31 1 Klaas TJEBBES
</pre>
32 5 Klaas TJEBBES
33 5 Klaas TJEBBES
Ou directement :
34 5 Klaas TJEBBES
<pre>
35 11 Gérald Schwartzmann
$ python osc --url http://one.eole.lan/ --vm <ID_VM> --startvnc
36 5 Klaas TJEBBES
</pre>
37 11 Gérald Schwartzmann
38 11 Gérald Schwartzmann
<ID_VM> est l'ID OpenNebula de la machine virtuelle (voir dans l'interface "Virtual Resources" => "Virtual Machines" => "ID").
39 9 Gérald Schwartzmann
40 14 Gérald Schwartzmann
h1. Exemple d'usage
41 14 Gérald Schwartzmann
42 14 Gérald Schwartzmann
<pre>
43 14 Gérald Schwartzmann
$ python osc --url http://one.eole.lan
44 14 Gérald Schwartzmann
List of current VMs:
45 14 Gérald Schwartzmann
26953 - etb1.amon-2.5.2a1-instance-default-26953 (ACTIVE/RUNNING)
46 14 Gérald Schwartzmann
Select a virtual machine id or q|quit to exit
47 14 Gérald Schwartzmann
[q]: 26953 ← appuyer sur la touche entrée
48 14 Gérald Schwartzmann
List of available actions:
49 14 Gérald Schwartzmann
0 - startvnc
50 14 Gérald Schwartzmann
Select an action to perform on 26953 - etb1.amon-2.5.2a1-instance-default-26953, or q|quit to exit
51 14 Gérald Schwartzmann
[startvnc]: ← appuyer sur la touche entrée
52 14 Gérald Schwartzmann
</pre>
53 14 Gérald Schwartzmann
54 16 Gérald Schwartzmann
h1. Compléments
55 16 Gérald Schwartzmann
56 16 Gérald Schwartzmann
Les caractères clavier / ou \ fonctionne par contre le copier coller (ctrl + c, ctrl + v) ne semble pas fonctionner.
57 16 Gérald Schwartzmann
58 9 Gérald Schwartzmann
h1. FAQ
59 9 Gérald Schwartzmann
60 15 Gérald Schwartzmann
h2. Message d'erreur *No module named bs4*
61 15 Gérald Schwartzmann
62 10 Gérald Schwartzmann
<pre>
63 10 Gérald Schwartzmann
$ python osc --url http://one.eole.lan/
64 9 Gérald Schwartzmann
Traceback (most recent call last):
65 9 Gérald Schwartzmann
  File "osc", line 36, in <module>
66 1 Klaas TJEBBES
    from bs4 import BeautifulSoup
67 9 Gérald Schwartzmann
ImportError: No module named bs4
68 10 Gérald Schwartzmann
</pre>
69 15 Gérald Schwartzmann
70 15 Gérald Schwartzmann
h2. Solution
71 13 Gérald Schwartzmann
72 13 Gérald Schwartzmann
Installer python-bs4 et non python3-bs4