chef-boneyard / knife-oraclecloud

Knife plugin for Oracle Cloud Infrastructure Classic
Apache License 2.0
4 stars 5 forks source link

Looks like if public-ip option is used with ipreservation name the parsing fails #9

Open prparmar77 opened 8 years ago

prparmar77 commented 8 years ago
[opc@fb0611 ~]$ knife oraclecloud server create --image /oracle/public/OL-6.6-20GB-x11-RD --shape oc3 --hostname purple-acs4 --public-ip purple-                     acs1-ip --ssh-user opc --sshkeys prakash.parmar1234@oracle.com/orch-publickey --identity-file /home/opc/id_rsa
Orchestration prakash.parmar1234@oracle.com/purple-acs4 started - waiting for it to complete...

Current status: starting...
Current status: error...........................................................................................................................                     .............................

Looks at the Orchestration suggests the following 

{
    "relationships": [],
    "status": "error",
    "account": "/Compute-usoracle498723/default",
    "description": "purple-acs4 by prakash.parmar1234@oracle.com via Knife",
    "schedule": {
        "start_time": "2016-04-22T16:19:41Z",
        "stop_time": null
    },
    "uri": "http://api-z2834-internal.compute.usdc6123.oraclecloud.com/orchestration/Compute-usoracle498723/prakash.parmar%401234oracle.com/purple-acs4",
    "oplans": [
        {
            "status": "error",
            "info": {
                "errors": {
                    "0": "{u'instances[purple-acs4].nat': [u\"cannot parse nat specified (ipreservation:ipreservation:purple-acs1-ip) for purple-acs4 - should be prefixed with either 'ippool:' or 'ipreservation:'\"]}"
                }
            },
            "obj_type": "launchplan",
            "ha_policy": "active",
            "label": "launch_plan",
            "objects": [
                {
                    "instances": [
                        {
                            "networking": {
                                "eth0": {
                                    "nat": "ipreservation:ipreservation:purple-acs1-ip"
                                }
                            },
                            "name": "/Compute-usoracle498723/prakash.parmar1234@oracle.com/purple-acs4",
                            "uri": null,
                            "label": "purple-acs4",
                            "shape": "oc3",
                            "imagelist": "/oracle/public/OL-6.6-20GB-x11-RD",
                            "sshkeys": [
                                "Compute-usoracle498723/prakash.parmar1234@oracle.com/orch-publickey"
                            ]
                        }
                    ]
                }
            ],
            "status_timestamp": "2016-04-22T16:19:50Z"
        }
    ],
    "info": {
        "errors": {
            "launch_plan": "error"
        }
    },
    "status_timestamp": "2016-04-22T16:19:50Z",
    "name": "/Compute-usoracle498723/prakash.parmar1234@oracle.com/purple-acs4",
    "_paasResource": false,
    "_personalResource": true
}

Looks like word ipreservation is appended twice on submitting the orchestration ..

prparmar77 commented 8 years ago

I tried using --public-ip pool option and it works fine.I am new to ruby etc and I think I know the code which is failing /knife-oraclecloud-master/knife-oraclecloud-master/lib/chef/knife/oraclecloud_server_create.rb

def public_ip return nil unless locate_config_value(:public_ip)

      (locate_config_value(:public_ip) == "pool") ? :pool : "ipreservation:#{locate_config_value(:public_ip)}"
    end

I think it should be treated by appending the service.prepend_identity_domain(:public_ip)

Can you tell me or guide how to rebuild the code locally so that I can fix some of the issues and you can merge or if I want add some of the feature I can create my own ..

prparmar77 commented 8 years ago

Ok I managed to rebuild the code with modification and can now see things are working fine when I give ipreservation name.Note that documentation needs to be updated saying that username should be appended to public-ip reservation name while calling server creation

jjasghar commented 8 years ago

Can you put in a PR for this documentation change?