{"action":"created","comment":{"url":"https://api.github.com/repos/01org/ciao/pulls/comments/60712154","id":60712154,"diff_hunk":"@@ -0,0 +1,83 @@\n+/*\n+// Copyright (c) 2016 Intel Corporation\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//      http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+*/\n+\n+package config\n+\n+import (\n+\t\"encoding/json\"\n+\t\"fmt\"\n+\t\"io/ioutil\"\n+\t\"log\"\n+\t\"os\"\n+)\n+\n+type CIAOConfig struct {\n+\tUsedFile  string\n+\tLauncher  LauncherConfig\n+}\n+\n+type LauncherConfig struct {\n+\tServer      string `json:\"server\"`\n+\tCACert      string `json:\"cacert\"`\n+\tCert        string `json:\"cert\"`\n+\tComputeNet  string `json:\"compute-net\"`\n+\tMgmtNet     string `json:\"mgmt-net\"`\n+\tHardReset   bool   `json:\"hard-reset\"`\n+\tDiskLimit   bool   `json:\"disk-limit\"`\n+\tMemLimit    bool   `json:\"mem-limit\"`\n+\tSimulation  bool   `json:\"simulation\"`\n+}\n+\n+func (launcher *LauncherConfig) initLauncher(){\n+\tlauncher.Server     = \"localhost\"\n+\tlauncher.CACert     = \"/etc/pki/ciao/CAcert-server-localhost.pem\"\n+\tlauncher.Cert       = \"/etc/pki/ciao/cert-client-localhost.pem\"\n+\tlauncher.ComputeNet = \"\"\n+\tlauncher.MgmtNet    = \"\"\n+ \tlauncher.HardReset  = false\n+\tlauncher.DiskLimit  = true\n+\tlauncher.MemLimit = true\n+\tlauncher.Simulation = false\n+}\n+\n+func loadConfigFile(path, filename string, ciaoConf CIAOConfig)  CIAOConfig {\n+\tfilePath := fmt.Sprintf(\"%s/%s\", path, filename)","path":"config/config.go","position":57,"original_position":57,"commit_id":"e1a00131c93c13bd868a7614f6f886b556689be6","original_commit_id":"e1a00131c93c13bd868a7614f6f886b556689be6","user":{"login":"markdryan","id":984073,"avatar_url":"https://avatars.githubusercontent.com/u/984073?v=3","gravatar_id":"","url":"https://api.github.com/users/markdryan","html_url":"https://github.com/markdryan","followers_url":"https://api.github.com/users/markdryan/followers","following_url":"https://api.github.com/users/markdryan/following{/other_user}","gists_url":"https://api.github.com/users/markdryan/gists{/gist_id}","starred_url":"https://api.github.com/users/markdryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markdryan/subscriptions","organizations_url":"https://api.github.com/users/markdryan/orgs","repos_url":"https://api.github.com/users/markdryan/repos","events_url":"https://api.github.com/users/markdryan/events{/privacy}","received_events_url":"https://api.github.com/users/markdryan/received_events","type":"User","site_admin":false},"body":"use path.Join, e.g.,\r\n\r\nfilePath := path.Join(path, filename)","created_at":"2016-04-22T09:21:21Z","updated_at":"2016-04-22T09:21:21Z","html_url":"https://github.com/01org/ciao/pull/56#discussion_r60712154","pull_request_url":"https://api.github.com/repos/01org/ciao/pulls/56","_links":{"self":{"href":"https://api.github.com/repos/01org/ciao/pulls/comments/60712154"},"html":{"href":"https://github.com/01org/ciao/pull/56#discussion_r60712154"},"pull_request":{"href":"https://api.github.com/repos/01org/ciao/pulls/56"}}},"pull_request":{"url":"https://api.github.com/repos/01org/ciao/pulls/56","id":67431634,"html_url":"https://github.com/01org/ciao/pull/56","diff_url":"https://github.com/01org/ciao/pull/56.diff","patch_url":"https://github.com/01org/ciao/pull/56.patch","issue_url":"https://api.github.com/repos/01org/ciao/issues/56","number":56,"state":"closed","locked":false,"title":"Add configuration file support to ciao-launcher","user":{"login":"obedmr","id":2779484,"avatar_url":"https://avatars.githubusercontent.com/u/2779484?v=3","gravatar_id":"","url":"https://api.github.com/users/obedmr","html_url":"https://github.com/obedmr","followers_url":"https://api.github.com/users/obedmr/followers","following_url":"https://api.github.com/users/obedmr/following{/other_user}","gists_url":"https://api.github.com/users/obedmr/gists{/gist_id}","starred_url":"https://api.github.com/users/obedmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obedmr/subscriptions","organizations_url":"https://api.github.com/users/obedmr/orgs","repos_url":"https://api.github.com/users/obedmr/repos","events_url":"https://api.github.com/users/obedmr/events{/privacy}","received_events_url":"https://api.github.com/users/obedmr/received_events","type":"User","site_admin":false},"body":"In order to make it more easy to use in a production server environment and\r\nmake it ready for OS init systems like systemd or sysvinit, here are the new\r\nproposed features:\r\n\r\n  - \"config\" module for handling the CIAO config files parsing\r\n    - This module would contain all modules default structs\r\n  - New CIAO config sample file at etc/ciao/ciao.json\r\n    - We'll have the following sections:\r\n      - launcher\r\n      - scheduler\r\n      - controller\r\n      - cnci-agent\r\n  - If you don't have any configuration file, services will start with\r\n    defaults that were set in config module\r\n  - Once you have the /etc/ciao/ciao.json file and you edited as needed,\r\n    you can start ciao-launcher as compute node:\r\n    \t$ ./cioa-launcher --network=cn\r\n    - Parameters reading priorities are (first has higher priority):\r\n      1. Values from In-command parameters (It overwrites below specified values)\r\n      2. Values from /etc/ciao (It overwrites below specified values)\r\n      3. Values from /usr/share/default/ciao/\r\n\r\nSigned-off-by: Munoz, Obed N <obed.n.munoz@intel.com>","created_at":"2016-04-21T22:18:57Z","updated_at":"2016-04-22T09:21:21Z","closed_at":"2016-04-21T22:21:29Z","merged_at":null,"merge_commit_sha":"5001fa4fca03c33cd0903708b3142696628fa283","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/01org/ciao/pulls/56/commits","review_comments_url":"https://api.github.com/repos/01org/ciao/pulls/56/comments","review_comment_url":"https://api.github.com/repos/01org/ciao/pulls/comments{/number}","comments_url":"https://api.github.com/repos/01org/ciao/issues/56/comments","statuses_url":"https://api.github.com/repos/01org/ciao/statuses/e1a00131c93c13bd868a7614f6f886b556689be6","head":{"label":"obedmr:config","ref":"config","sha":"e1a00131c93c13bd868a7614f6f886b556689be6","user":{"login":"obedmr","id":2779484,"avatar_url":"https://avatars.githubusercontent.com/u/2779484?v=3","gravatar_id":"","url":"https://api.github.com/users/obedmr","html_url":"https://github.com/obedmr","followers_url":"https://api.github.com/users/obedmr/followers","following_url":"https://api.github.com/users/obedmr/following{/other_user}","gists_url":"https://api.github.com/users/obedmr/gists{/gist_id}","starred_url":"https://api.github.com/users/obedmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obedmr/subscriptions","organizations_url":"https://api.github.com/users/obedmr/orgs","repos_url":"https://api.github.com/users/obedmr/repos","events_url":"https://api.github.com/users/obedmr/events{/privacy}","received_events_url":"https://api.github.com/users/obedmr/received_events","type":"User","site_admin":false},"repo":{"id":56723535,"name":"ciao","full_name":"obedmr/ciao","owner":{"login":"obedmr","id":2779484,"avatar_url":"https://avatars.githubusercontent.com/u/2779484?v=3","gravatar_id":"","url":"https://api.github.com/users/obedmr","html_url":"https://github.com/obedmr","followers_url":"https://api.github.com/users/obedmr/followers","following_url":"https://api.github.com/users/obedmr/following{/other_user}","gists_url":"https://api.github.com/users/obedmr/gists{/gist_id}","starred_url":"https://api.github.com/users/obedmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obedmr/subscriptions","organizations_url":"https://api.github.com/users/obedmr/orgs","repos_url":"https://api.github.com/users/obedmr/repos","events_url":"https://api.github.com/users/obedmr/events{/privacy}","received_events_url":"https://api.github.com/users/obedmr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/obedmr/ciao","description":"Ciao - Cloud Integrated Advanced Orchestrator","fork":true,"url":"https://api.github.com/repos/obedmr/ciao","forks_url":"https://api.github.com/repos/obedmr/ciao/forks","keys_url":"https://api.github.com/repos/obedmr/ciao/keys{/key_id}","collaborators_url":"https://api.github.com/repos/obedmr/ciao/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/obedmr/ciao/teams","hooks_url":"https://api.github.com/repos/obedmr/ciao/hooks","issue_events_url":"https://api.github.com/repos/obedmr/ciao/issues/events{/number}","events_url":"https://api.github.com/repos/obedmr/ciao/events","assignees_url":"https://api.github.com/repos/obedmr/ciao/assignees{/user}","branches_url":"https://api.github.com/repos/obedmr/ciao/branches{/branch}","tags_url":"https://api.github.com/repos/obedmr/ciao/tags","blobs_url":"https://api.github.com/repos/obedmr/ciao/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/obedmr/ciao/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/obedmr/ciao/git/refs{/sha}","trees_url":"https://api.github.com/repos/obedmr/ciao/git/trees{/sha}","statuses_url":"https://api.github.com/repos/obedmr/ciao/statuses/{sha}","languages_url":"https://api.github.com/repos/obedmr/ciao/languages","stargazers_url":"https://api.github.com/repos/obedmr/ciao/stargazers","contributors_url":"https://api.github.com/repos/obedmr/ciao/contributors","subscribers_url":"https://api.github.com/repos/obedmr/ciao/subscribers","subscription_url":"https://api.github.com/repos/obedmr/ciao/subscription","commits_url":"https://api.github.com/repos/obedmr/ciao/commits{/sha}","git_commits_url":"https://api.github.com/repos/obedmr/ciao/git/commits{/sha}","comments_url":"https://api.github.com/repos/obedmr/ciao/comments{/number}","issue_comment_url":"https://api.github.com/repos/obedmr/ciao/issues/comments{/number}","contents_url":"https://api.github.com/repos/obedmr/ciao/contents/{+path}","compare_url":"https://api.github.com/repos/obedmr/ciao/compare/{base}...{head}","merges_url":"https://api.github.com/repos/obedmr/ciao/merges","archive_url":"https://api.github.com/repos/obedmr/ciao/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/obedmr/ciao/downloads","issues_url":"https://api.github.com/repos/obedmr/ciao/issues{/number}","pulls_url":"https://api.github.com/repos/obedmr/ciao/pulls{/number}","milestones_url":"https://api.github.com/repos/obedmr/ciao/milestones{/number}","notifications_url":"https://api.github.com/repos/obedmr/ciao/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/obedmr/ciao/labels{/name}","releases_url":"https://api.github.com/repos/obedmr/ciao/releases{/id}","deployments_url":"https://api.github.com/repos/obedmr/ciao/deployments","created_at":"2016-04-20T21:54:14Z","updated_at":"2016-04-20T21:54:15Z","pushed_at":"2016-04-21T22:24:43Z","git_url":"git://github.com/obedmr/ciao.git","ssh_url":"git@github.com:obedmr/ciao.git","clone_url":"https://github.com/obedmr/ciao.git","svn_url":"https://github.com/obedmr/ciao","homepage":"","size":752,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"01org:master","ref":"master","sha":"126b84353a2f7183c1e896c5f08f881ad1f75f79","user":{"login":"01org","id":1635439,"avatar_url":"https://avatars.githubusercontent.com/u/1635439?v=3","gravatar_id":"","url":"https://api.github.com/users/01org","html_url":"https://github.com/01org","followers_url":"https://api.github.com/users/01org/followers","following_url":"https://api.github.com/users/01org/following{/other_user}","gists_url":"https://api.github.com/users/01org/gists{/gist_id}","starred_url":"https://api.github.com/users/01org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/01org/subscriptions","organizations_url":"https://api.github.com/users/01org/orgs","repos_url":"https://api.github.com/users/01org/repos","events_url":"https://api.github.com/users/01org/events{/privacy}","received_events_url":"https://api.github.com/users/01org/received_events","type":"Organization","site_admin":false},"repo":{"id":54660486,"name":"ciao","full_name":"01org/ciao","owner":{"login":"01org","id":1635439,"avatar_url":"https://avatars.githubusercontent.com/u/1635439?v=3","gravatar_id":"","url":"https://api.github.com/users/01org","html_url":"https://github.com/01org","followers_url":"https://api.github.com/users/01org/followers","following_url":"https://api.github.com/users/01org/following{/other_user}","gists_url":"https://api.github.com/users/01org/gists{/gist_id}","starred_url":"https://api.github.com/users/01org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/01org/subscriptions","organizations_url":"https://api.github.com/users/01org/orgs","repos_url":"https://api.github.com/users/01org/repos","events_url":"https://api.github.com/users/01org/events{/privacy}","received_events_url":"https://api.github.com/users/01org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/01org/ciao","description":"Ciao - Cloud Integrated Advanced Orchestrator","fork":false,"url":"https://api.github.com/repos/01org/ciao","forks_url":"https://api.github.com/repos/01org/ciao/forks","keys_url":"https://api.github.com/repos/01org/ciao/keys{/key_id}","collaborators_url":"https://api.github.com/repos/01org/ciao/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/01org/ciao/teams","hooks_url":"https://api.github.com/repos/01org/ciao/hooks","issue_events_url":"https://api.github.com/repos/01org/ciao/issues/events{/number}","events_url":"https://api.github.com/repos/01org/ciao/events","assignees_url":"https://api.github.com/repos/01org/ciao/assignees{/user}","branches_url":"https://api.github.com/repos/01org/ciao/branches{/branch}","tags_url":"https://api.github.com/repos/01org/ciao/tags","blobs_url":"https://api.github.com/repos/01org/ciao/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/01org/ciao/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/01org/ciao/git/refs{/sha}","trees_url":"https://api.github.com/repos/01org/ciao/git/trees{/sha}","statuses_url":"https://api.github.com/repos/01org/ciao/statuses/{sha}","languages_url":"https://api.github.com/repos/01org/ciao/languages","stargazers_url":"https://api.github.com/repos/01org/ciao/stargazers","contributors_url":"https://api.github.com/repos/01org/ciao/contributors","subscribers_url":"https://api.github.com/repos/01org/ciao/subscribers","subscription_url":"https://api.github.com/repos/01org/ciao/subscription","commits_url":"https://api.github.com/repos/01org/ciao/commits{/sha}","git_commits_url":"https://api.github.com/repos/01org/ciao/git/commits{/sha}","comments_url":"https://api.github.com/repos/01org/ciao/comments{/number}","issue_comment_url":"https://api.github.com/repos/01org/ciao/issues/comments{/number}","contents_url":"https://api.github.com/repos/01org/ciao/contents/{+path}","compare_url":"https://api.github.com/repos/01org/ciao/compare/{base}...{head}","merges_url":"https://api.github.com/repos/01org/ciao/merges","archive_url":"https://api.github.com/repos/01org/ciao/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/01org/ciao/downloads","issues_url":"https://api.github.com/repos/01org/ciao/issues{/number}","pulls_url":"https://api.github.com/repos/01org/ciao/pulls{/number}","milestones_url":"https://api.github.com/repos/01org/ciao/milestones{/number}","notifications_url":"https://api.github.com/repos/01org/ciao/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/01org/ciao/labels{/name}","releases_url":"https://api.github.com/repos/01org/ciao/releases{/id}","deployments_url":"https://api.github.com/repos/01org/ciao/deployments","created_at":"2016-03-24T17:19:34Z","updated_at":"2016-04-21T04:20:54Z","pushed_at":"2016-04-21T22:27:12Z","git_url":"git://github.com/01org/ciao.git","ssh_url":"git@github.com:01org/ciao.git","clone_url":"https://github.com/01org/ciao.git","svn_url":"https://github.com/01org/ciao","homepage":"","size":783,"stargazers_count":6,"watchers_count":6,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":43,"forks":2,"open_issues":43,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/01org/ciao/pulls/56"},"html":{"href":"https://github.com/01org/ciao/pull/56"},"issue":{"href":"https://api.github.com/repos/01org/ciao/issues/56"},"comments":{"href":"https://api.github.com/repos/01org/ciao/issues/56/comments"},"review_comments":{"href":"https://api.github.com/repos/01org/ciao/pulls/56/comments"},"review_comment":{"href":"https://api.github.com/repos/01org/ciao/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/01org/ciao/pulls/56/commits"},"statuses":{"href":"https://api.github.com/repos/01org/ciao/statuses/e1a00131c93c13bd868a7614f6f886b556689be6"}}}}