{"action":"opened","issue":{"url":"https://api.github.com/repos/thingful/device-hub/issues/60","repository_url":"https://api.github.com/repos/thingful/device-hub","labels_url":"https://api.github.com/repos/thingful/device-hub/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/thingful/device-hub/issues/60/comments","events_url":"https://api.github.com/repos/thingful/device-hub/issues/60/events","html_url":"https://github.com/thingful/device-hub/issues/60","id":237178004,"number":60,"title":"Can't delete profiles created with -d flag","user":{"login":"chespinoza","id":3278356,"avatar_url":"https://avatars2.githubusercontent.com/u/3278356?v=3","gravatar_id":"","url":"https://api.github.com/users/chespinoza","html_url":"https://github.com/chespinoza","followers_url":"https://api.github.com/users/chespinoza/followers","following_url":"https://api.github.com/users/chespinoza/following{/other_user}","gists_url":"https://api.github.com/users/chespinoza/gists{/gist_id}","starred_url":"https://api.github.com/users/chespinoza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chespinoza/subscriptions","organizations_url":"https://api.github.com/users/chespinoza/orgs","repos_url":"https://api.github.com/users/chespinoza/repos","events_url":"https://api.github.com/users/chespinoza/events{/privacy}","received_events_url":"https://api.github.com/users/chespinoza/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-20T11:28:41Z","updated_at":"2017-06-20T11:28:41Z","closed_at":null,"body":"**Platform:** Osx El capitan(darwin)\r\n**Details:** Profiles created with -d flag can't be deleted neither individually with -f flag nor with -d\r\n**How to reproduce:** \r\nCreate listener, profiles and endpoints using -d flag with the test configurations\r\n```\r\n>./device-hub-cli-darwin-amd64 create -d ../../test-configurations/\r\nhttp_listener.yaml\r\nhttp_out_endpoint.yaml\r\nmqtt_listener.yaml\r\nmqtt_listener_helsinki.yaml\r\nprofile_helsinki.yaml\r\nprofile_script.yaml\r\nprofile_script_transform.yaml\r\nprofile_script_transform_with_external_context.yaml\r\nstd_out_endpoint.yaml\r\n{\"ok\":true,\"error\":\"\",\"uid\":\"http-listener-local-port-8085\"}\r\n{\"ok\":true,\"error\":\"\",\"uid\":\"http-endpoint-example.com\"}\r\n{\"ok\":true,\"error\":\"\",\"uid\":\"mqtt-listener-local-port-1883\"}\r\n{\"ok\":true,\"error\":\"\",\"uid\":\"mqtt-helsinki-transport-service-listener\"}\r\n{\"ok\":true,\"error\":\"\",\"uid\":\"thingful/helsinki-bus\"}\r\n{\"ok\":true,\"error\":\"\",\"uid\":\"thingful/device-1\"}\r\n{\"ok\":true,\"error\":\"\",\"uid\":\"thingful/device-2\"}\r\n{\"ok\":true,\"error\":\"\",\"uid\":\"thingful/device-3\"}\r\n{\"ok\":true,\"error\":\"\",\"uid\":\"stdout-endpoint\"}\r\n```\r\n\r\nDelete all \r\n```\r\n>./device-hub-cli-darwin-amd64 delete -d ../../test-configurations/\r\nhttp_listener.yaml\r\nhttp_out_endpoint.yaml\r\nmqtt_listener.yaml\r\nmqtt_listener_helsinki.yaml\r\nprofile_helsinki.yaml\r\nprofile_script.yaml\r\nprofile_script_transform.yaml\r\nprofile_script_transform_with_external_context.yaml\r\nstd_out_endpoint.yaml\r\n{\"ok\":true,\"error\":\"\"}\r\n{\"ok\":true,\"error\":\"\"}\r\n{\"ok\":true,\"error\":\"\"}\r\n{\"ok\":true,\"error\":\"\"}\r\n{\"ok\":true,\"error\":\"\"}\r\n{\"ok\":true,\"error\":\"\"}\r\n{\"ok\":true,\"error\":\"\"}\r\n{\"ok\":true,\"error\":\"\"}\r\n{\"ok\":true,\"error\":\"\"}\r\n```\r\n\r\nCheck\r\n```\r\n>./device-hub-cli-darwin-amd64 get all | jq\r\n{\r\n  \"ok\": true,\r\n  \"error\": \"\",\r\n  \"entities\": [\r\n    {\r\n      \"uid\": \"thingful/device-1\",\r\n      \"type\": \"profile\",\r\n      \"kind\": \"script\",\r\n      \"configuration\": {\r\n        \"profile-description\": \"blah blah blah\",\r\n        \"profile-name\": \"thingful/device-1\",\r\n        \"profile-version\": \"1.0.0-beta\",\r\n        \"script-contents\": \"function xxx ( input ) {\\n  return input\\n}\\n\",\r\n        \"script-input\": \"json\",\r\n        \"script-main\": \"xxx\",\r\n        \"script-runtime\": \"javascript\"\r\n      }\r\n    },\r\n    {\r\n      \"uid\": \"thingful/device-2\",\r\n      \"type\": \"profile\",\r\n      \"kind\": \"script\",\r\n      \"configuration\": {\r\n        \"profile-description\": \"blah blah blah\",\r\n        \"profile-name\": \"thingful/device-2\",\r\n        \"profile-version\": \"1.0.1-beta\",\r\n        \"script-contents\": \"// decode adds ontology information to the input\\n function decode (input) {\\n  // you can log to debug your script!\\n  //console.log(\\\"decode called\\\")\\n\\n  input['@context'] = {\\n    // define the terms against the m3-lite ontology\\n    // http://ontology.fiesta-iot.eu/ontologyDocs/fiesta-iot/doc\\n    'm3-lite': 'http://purl.org/iot/vocab/m3-lite#',\\n    // add in a decode context for the unique id\\n    'decode' : 'http://decode.xxx',\\n  }\\n\\n  input['@id'] = \\\"decode:/\\\" + input['deviceId'] + ':' + input['createdAt']\\n\\n  // it is an air pollutant sensor\\n  input['@type'] = \\\"m3-lite:AirPollutantSensor\\\"\\n\\n  // in the environment domain\\n  input['domain'] = {\\n  \\\"@type\\\" : \\\"m3-lite:Environment\\\"\\n  }\\n\\n  // TODO : what 'is' the value, date format, unit?\\n  return input\\n}\\n\",\r\n        \"script-input\": \"json\",\r\n        \"script-main\": \"decode\",\r\n        \"script-runtime\": \"javascript\"\r\n      }\r\n    },\r\n    {\r\n      \"uid\": \"thingful/device-3\",\r\n      \"type\": \"profile\",\r\n      \"kind\": \"script\",\r\n      \"configuration\": {\r\n        \"profile-description\": \"blah blah blah\",\r\n        \"profile-name\": \"thingful/device-3\",\r\n        \"profile-version\": \"1.0.1-beta\",\r\n        \"schema\": \"{\\n    \\\"@context\\\": {\\n        \\\"decode\\\"    : \\\"http://decode.eu#\\\",\\n        \\\"m3-lite\\\"   : \\\"http://purl.org/iot/vocab/m3-lite#\\\",\\n        \\\"schema\\\"    : \\\"http://schema.org/\\\",\\n        \\\"domain\\\"    : \\\"decode:hasDomain\\\",\\n        \\\"timeStamp\\\" : \\\"schema:Date\\\",\\n        \\\"reading\\\"   : \\\"decode:AtmosphericConcentrationAirParticlesPM25\\\"\\n    },\\n    \\\"@type\\\" : \\\"m3-lite:AirPollutantSensor\\\",\\n    \\\"domain\\\": {\\n        \\\"@type\\\": \\\"m3-lite:Environment\\\"\\n    }\\n}\\n\",\r\n        \"script-contents\": \"function decode (input) {\\n    // { deviceId : xx , createdAt : some-date, value : some-number  }\\n\\n    return {\\n        '@id' : input['deviceId'],\\n        'timeStamp' : input['createdAt'],\\n        'reading' : input['value']\\n    }\\n}\\n\",\r\n        \"script-input\": \"json\",\r\n        \"script-main\": \"decode\",\r\n        \"script-runtime\": \"javascript\"\r\n      }\r\n    },\r\n    {\r\n      \"uid\": \"thingful/helsinki-bus\",\r\n      \"type\": \"profile\",\r\n      \"kind\": \"script\",\r\n      \"configuration\": {\r\n        \"profile-description\": \"device profile for the helsinki journey api /hfp/journey/bus\",\r\n        \"profile-name\": \"thingful/helsinki-bus\",\r\n        \"profile-version\": \"1.0.0-beta\",\r\n        \"schema\": \"{\\n    \\\"@context\\\": {\\n        \\\"decode\\\"    : \\\"http://decode.eu#\\\",\\n        \\\"m3-lite\\\"   : \\\"http://purl.org/iot/vocab/m3-lite#\\\",\\n        \\\"schema\\\"    : \\\"http://schema.org/\\\",\\n        \\\"domain\\\"    : \\\"decode:hasDomain\\\",\\n        \\\"timeStamp\\\" : \\\"schema:Date\\\",\\n        \\\"geo\\\" : \\\"schema:GeoCoordinates\\\"\\n    },\\n    \\\"@type\\\" : \\\"decode:Bus\\\",\\n    \\\"domain\\\": {\\n        \\\"@type\\\": \\\"decode:Transport\\\"\\n    }\\n}\\n\",\r\n        \"script-contents\": \"function x (input) { /* https://api.digitransit.fi/realtime/vehicle-positions/v1/hfp/journey/# https://digipalvelutehdas.hackpad.com/HSL-MQTT-API-draft#HSL-MQTT-API-draft Example VP: {\\n    desi: \\\"615\\\",\\n    dir: \\\"1\\\",\\n    oper: \\\"XXX\\\",\\n    veh: \\\"1219\\\",\\n    tst: \\\"2017-05-26T13:03:14.000Z\\\",\\n    tsi: 1495803794,\\n    spd: 0,\\n    lat: 60.17129,\\n    long: 24.94316,\\n    jrn: \\\"XXX\\\",\\n    line: \\\"XXX\\\",\\n    start: \\\"1609\\\",\\n    source: \\\"hsl helmi\\\"\\n} From the docs -\\ndesi\\tdesignation (route/line number as shown to passengers) oday\\toperating day (day of departure) tsi and tst\\ttimestamp dl\\tdelay (difference to timetable) lat, long\\tcoordinates hdg\\theading odo\\todometer spd\\tspeed\\n*/\\n    root = input['VP']\\n\\n    return {\\n        '@id' : root['veh'],\\n        'timeStamp' : root['tst'],\\n        'geo': {\\n            'latitude': root['lat'],\\n            'longitude': root['long']\\n        },\\n        'route': {\\n            'from' : root['start'] ,\\n            'to' : root['desi']\\n        }\\n    }\\n}\\n\",\r\n        \"script-input\": \"json\",\r\n        \"script-main\": \"x\",\r\n        \"script-runtime\": \"javascript\"\r\n      }\r\n    }\r\n  ]\r\n}\r\n```\r\n"}}
{"actor":{"display_login":"chespinoza"}}