Browse code

Update local.sh sample file to use OSC

Besides updating to OSC CLI, this patch also fixes an argument name typo
present before in 'nova keypair-add' (--pub_key should be --pub-key).

Specifying $OS_PROJECT_NAME in case user is associated to multiple
projects containing security groups with same name (e.g. 'default').

Change-Id: I776f6edfc4c6c798a39d3260827a18c695f05c87

Carlos Goncalves authored on 2016/11/11 23:02:57
Showing 1 changed files
... ...
@@ -36,7 +36,7 @@ if is_service_enabled nova; then
36 36
     # Add first keypair found in localhost:$HOME/.ssh
37 37
     for i in $HOME/.ssh/id_rsa.pub $HOME/.ssh/id_dsa.pub; do
38 38
         if [[ -r $i ]]; then
39
-            nova keypair-add --pub_key=$i `hostname`
39
+            openstack keypair create --public-key $i `hostname`
40 40
             break
41 41
         fi
42 42
     done
... ...
@@ -53,8 +53,8 @@ if is_service_enabled nova; then
53 53
     MI_NAME=m1.micro
54 54
 
55 55
     # Create micro flavor if not present
56
-    if [[ -z $(nova flavor-list | grep $MI_NAME) ]]; then
57
-        nova flavor-create $MI_NAME 6 128 0 1
56
+    if [[ -z $(openstack flavor list | grep $MI_NAME) ]]; then
57
+        openstack flavor create $MI_NAME --id 6 --ram 128 --disk 0 --vcpus 1
58 58
     fi
59 59
 
60 60
 
... ...
@@ -62,7 +62,7 @@ if is_service_enabled nova; then
62 62
     # ----------
63 63
 
64 64
     # Add tcp/22 and icmp to default security group
65
-    nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
66
-    nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
65
+    openstack security group rule create --project $OS_PROJECT_NAME default --protocol tcp --ingress --dst-port 22
66
+    openstack security group rule create --project $OS_PROJECT_NAME default --protocol icmp
67 67
 
68 68
 fi