{"action":"created","comment":{"url":"https://api.github.com/repos/rancher/rancher-catalog-service/pulls/comments/70488745","id":70488745,"diff_hunk":"@@ -47,16 +58,90 @@ var (\n \t//ValidationMode is used to determine if code is just checking Yaml syntax\n \tValidationMode bool\n \n-\tcatalogURL arrayFlags\n+\tcatalogURL     arrayFlags\n+\tcommandLineURL arrayFlags\n+\n+\t//URLBranchMap aps repo url to branch\n+\tURLBranchMap map[string]string\n+\n+\treloadChan = make(chan chan error)\n )\n \n //CatalogRootDir is the root folder under which all catalogs are cloned\n const CatalogRootDir string = \"./DATA/\"\n \n-//SetEnv parses the command line args and sets the necessary variables\n-func SetEnv() {\n+//WatchSignals handles SIGHUP\n+func WatchSignals() {\n+\tc := make(chan os.Signal, 1)\n+\tsignal.Notify(c, syscall.SIGHUP)\n+\n+\tgo func() {\n+\t\tfor _ = range c {\n+\t\t\tlog.Info(\"Received HUP signal\")\n+\t\t\tSetEnv()\n+\t\t\tgo Init()\n+\t\t}\n+\t}()\n+}\n+\n+//GetCommandLine parses the command line args\n+func GetCommandLine() {\n \tflag.Var(&catalogURL, \"catalogUrl\", \"git repo url in the form repo_id=repo_url. Specify the flag multiple times for multiple repos\")\n+\n \tflag.Parse()\n+\tcommandLineURL = catalogURL\n+\tSetEnv()\n+}\n+\n+//SetEnv parses the command line args and sets the necessary variables\n+func SetEnv() {\n+\n+\tcatalogURL = catalogURL[:0]\n+\tcatalogURL = commandLineURL\n+\n+\tvar catalogObject []CatalogInput\n+\tvar catalogObjectJSON []CatalogInput\n+\tvar catalogObjectNonEmptyJSON []CatalogInput\n+\tvar catalogObjectCommandLine []CatalogInput\n+\tURLBranchMap = make(map[string]string)\n+\n+\t//NEW CODE\n+\t// If catalog provided through command line\n+\tif len(catalogURL) > 0 {\n+\t\tfor i := 0; i < len(catalogURL); i++ {\n+\t\t\tcatalogObj := CatalogInput{}\n+\t\t\tcatalogObj.RepoURL = catalogURL[i]\n+\t\t\tcatalogObj.Branch = \"master\"\n+\t\t\tcatalogObjectCommandLine = append(catalogObjectCommandLine, catalogObj)\n+\t\t\tURLBranchMap[catalogObj.RepoURL] = catalogObj.Branch\n+\t\t}\n+\t\tcatalogObject = append(catalogObject, catalogObjectCommandLine...)\n+\t}\n+\n+\tlibraryContent, err := ioutil.ReadFile(\"./repo.json\")\n+\tif err != nil {\n+\t\tlog.Debugf(\"JSON file does not exist, continuing for command line URLs\")\n+\t} else {\n+\t\terr = json.Unmarshal(libraryContent, &catalogObjectJSON)\n+\t\tif err != nil {\n+\t\t\tlog.Errorf(\"JSON data format invalid, error : %v\\n\", err)\n+\t\t}\n+\n+\t\tfor objIndex := 0; objIndex < len(catalogObjectJSON); objIndex++ {\n+\t\t\tif (CatalogInput{} != catalogObjectJSON[objIndex]) {\n+\t\t\t\tcatalogObjectNonEmptyJSON = append(catalogObjectNonEmptyJSON, catalogObjectJSON[objIndex])\n+\t\t\t}\n+\t\t}\n+\n+\t\tcatalogObjectJSON = catalogObjectNonEmptyJSON\n+\t\tcatalogObject = append(catalogObject, catalogObjectJSON...)\n+\n+\t\tfor libraryIndex := 0; libraryIndex < len(catalogObjectJSON); libraryIndex++ {","path":"manager/catalog_manager.go","position":132,"original_position":132,"commit_id":"a3fc9d0ca2b7a0b6419a7fc114e8d5925d6c07a8","original_commit_id":"a3fc9d0ca2b7a0b6419a7fc114e8d5925d6c07a8","user":{"login":"vincent99","id":753917,"avatar_url":"https://avatars.githubusercontent.com/u/753917?v=3","gravatar_id":"","url":"https://api.github.com/users/vincent99","html_url":"https://github.com/vincent99","followers_url":"https://api.github.com/users/vincent99/followers","following_url":"https://api.github.com/users/vincent99/following{/other_user}","gists_url":"https://api.github.com/users/vincent99/gists{/gist_id}","starred_url":"https://api.github.com/users/vincent99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vincent99/subscriptions","organizations_url":"https://api.github.com/users/vincent99/orgs","repos_url":"https://api.github.com/users/vincent99/repos","events_url":"https://api.github.com/users/vincent99/events{/privacy}","received_events_url":"https://api.github.com/users/vincent99/received_events","type":"User","site_admin":false},"body":"`for _, value := range array {`, or this could all be combined with the previous pass through the array and less temporary variables","created_at":"2016-07-12T18:01:28Z","updated_at":"2016-07-12T18:01:28Z","html_url":"https://github.com/rancher/rancher-catalog-service/pull/55#discussion_r70488745","pull_request_url":"https://api.github.com/repos/rancher/rancher-catalog-service/pulls/55","_links":{"self":{"href":"https://api.github.com/repos/rancher/rancher-catalog-service/pulls/comments/70488745"},"html":{"href":"https://github.com/rancher/rancher-catalog-service/pull/55#discussion_r70488745"},"pull_request":{"href":"https://api.github.com/repos/rancher/rancher-catalog-service/pulls/55"}}},"pull_request":{"url":"https://api.github.com/repos/rancher/rancher-catalog-service/pulls/55","id":77040377,"html_url":"https://github.com/rancher/rancher-catalog-service/pull/55","diff_url":"https://github.com/rancher/rancher-catalog-service/pull/55.diff","patch_url":"https://github.com/rancher/rancher-catalog-service/pull/55.patch","issue_url":"https://api.github.com/repos/rancher/rancher-catalog-service/issues/55","number":55,"state":"open","locked":false,"title":"Branch support","user":{"login":"mrajashree","id":10672776,"avatar_url":"https://avatars.githubusercontent.com/u/10672776?v=3","gravatar_id":"","url":"https://api.github.com/users/mrajashree","html_url":"https://github.com/mrajashree","followers_url":"https://api.github.com/users/mrajashree/followers","following_url":"https://api.github.com/users/mrajashree/following{/other_user}","gists_url":"https://api.github.com/users/mrajashree/gists{/gist_id}","starred_url":"https://api.github.com/users/mrajashree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrajashree/subscriptions","organizations_url":"https://api.github.com/users/mrajashree/orgs","repos_url":"https://api.github.com/users/mrajashree/repos","events_url":"https://api.github.com/users/mrajashree/events{/privacy}","received_events_url":"https://api.github.com/users/mrajashree/received_events","type":"User","site_admin":false},"body":"Rancher-catalog-service can accept catalog URLs from a JSON file along with the command line argument. A sample JSON file is provided: repo.json. User can include any branch of the repository in the json. The service still accepts all command line args as it did previously","created_at":"2016-07-11T23:34:57Z","updated_at":"2016-07-12T18:01:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2cea0925201709d4b699f7cc0fb2a95cd3f8e4f5","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/rancher/rancher-catalog-service/pulls/55/commits","review_comments_url":"https://api.github.com/repos/rancher/rancher-catalog-service/pulls/55/comments","review_comment_url":"https://api.github.com/repos/rancher/rancher-catalog-service/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rancher/rancher-catalog-service/issues/55/comments","statuses_url":"https://api.github.com/repos/rancher/rancher-catalog-service/statuses/a3fc9d0ca2b7a0b6419a7fc114e8d5925d6c07a8","head":{"label":"mrajashree:branch_support","ref":"branch_support","sha":"a3fc9d0ca2b7a0b6419a7fc114e8d5925d6c07a8","user":{"login":"mrajashree","id":10672776,"avatar_url":"https://avatars.githubusercontent.com/u/10672776?v=3","gravatar_id":"","url":"https://api.github.com/users/mrajashree","html_url":"https://github.com/mrajashree","followers_url":"https://api.github.com/users/mrajashree/followers","following_url":"https://api.github.com/users/mrajashree/following{/other_user}","gists_url":"https://api.github.com/users/mrajashree/gists{/gist_id}","starred_url":"https://api.github.com/users/mrajashree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrajashree/subscriptions","organizations_url":"https://api.github.com/users/mrajashree/orgs","repos_url":"https://api.github.com/users/mrajashree/repos","events_url":"https://api.github.com/users/mrajashree/events{/privacy}","received_events_url":"https://api.github.com/users/mrajashree/received_events","type":"User","site_admin":false},"repo":{"id":61840588,"name":"rancher-catalog-service","full_name":"mrajashree/rancher-catalog-service","owner":{"login":"mrajashree","id":10672776,"avatar_url":"https://avatars.githubusercontent.com/u/10672776?v=3","gravatar_id":"","url":"https://api.github.com/users/mrajashree","html_url":"https://github.com/mrajashree","followers_url":"https://api.github.com/users/mrajashree/followers","following_url":"https://api.github.com/users/mrajashree/following{/other_user}","gists_url":"https://api.github.com/users/mrajashree/gists{/gist_id}","starred_url":"https://api.github.com/users/mrajashree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrajashree/subscriptions","organizations_url":"https://api.github.com/users/mrajashree/orgs","repos_url":"https://api.github.com/users/mrajashree/repos","events_url":"https://api.github.com/users/mrajashree/events{/privacy}","received_events_url":"https://api.github.com/users/mrajashree/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mrajashree/rancher-catalog-service","description":"A REST API service to list and walkthrough rancher compose templates","fork":true,"url":"https://api.github.com/repos/mrajashree/rancher-catalog-service","forks_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/forks","keys_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/teams","hooks_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/hooks","issue_events_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/issues/events{/number}","events_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/events","assignees_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/assignees{/user}","branches_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/branches{/branch}","tags_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/tags","blobs_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/statuses/{sha}","languages_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/languages","stargazers_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/stargazers","contributors_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/contributors","subscribers_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/subscribers","subscription_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/subscription","commits_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/contents/{+path}","compare_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/merges","archive_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/downloads","issues_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/issues{/number}","pulls_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/pulls{/number}","milestones_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/milestones{/number}","notifications_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/labels{/name}","releases_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/releases{/id}","deployments_url":"https://api.github.com/repos/mrajashree/rancher-catalog-service/deployments","created_at":"2016-06-23T22:19:57Z","updated_at":"2016-06-23T22:19:58Z","pushed_at":"2016-07-12T06:49:25Z","git_url":"git://github.com/mrajashree/rancher-catalog-service.git","ssh_url":"git@github.com:mrajashree/rancher-catalog-service.git","clone_url":"https://github.com/mrajashree/rancher-catalog-service.git","svn_url":"https://github.com/mrajashree/rancher-catalog-service","homepage":"","size":437,"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":"rancher:master","ref":"master","sha":"5829c97ff34a4f269b48aecee7bcc0f7c3c6f288","user":{"login":"rancher","id":9343010,"avatar_url":"https://avatars.githubusercontent.com/u/9343010?v=3","gravatar_id":"","url":"https://api.github.com/users/rancher","html_url":"https://github.com/rancher","followers_url":"https://api.github.com/users/rancher/followers","following_url":"https://api.github.com/users/rancher/following{/other_user}","gists_url":"https://api.github.com/users/rancher/gists{/gist_id}","starred_url":"https://api.github.com/users/rancher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rancher/subscriptions","organizations_url":"https://api.github.com/users/rancher/orgs","repos_url":"https://api.github.com/users/rancher/repos","events_url":"https://api.github.com/users/rancher/events{/privacy}","received_events_url":"https://api.github.com/users/rancher/received_events","type":"Organization","site_admin":false},"repo":{"id":43917365,"name":"rancher-catalog-service","full_name":"rancher/rancher-catalog-service","owner":{"login":"rancher","id":9343010,"avatar_url":"https://avatars.githubusercontent.com/u/9343010?v=3","gravatar_id":"","url":"https://api.github.com/users/rancher","html_url":"https://github.com/rancher","followers_url":"https://api.github.com/users/rancher/followers","following_url":"https://api.github.com/users/rancher/following{/other_user}","gists_url":"https://api.github.com/users/rancher/gists{/gist_id}","starred_url":"https://api.github.com/users/rancher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rancher/subscriptions","organizations_url":"https://api.github.com/users/rancher/orgs","repos_url":"https://api.github.com/users/rancher/repos","events_url":"https://api.github.com/users/rancher/events{/privacy}","received_events_url":"https://api.github.com/users/rancher/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rancher/rancher-catalog-service","description":"A REST API service to list and walkthrough rancher compose templates","fork":false,"url":"https://api.github.com/repos/rancher/rancher-catalog-service","forks_url":"https://api.github.com/repos/rancher/rancher-catalog-service/forks","keys_url":"https://api.github.com/repos/rancher/rancher-catalog-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rancher/rancher-catalog-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rancher/rancher-catalog-service/teams","hooks_url":"https://api.github.com/repos/rancher/rancher-catalog-service/hooks","issue_events_url":"https://api.github.com/repos/rancher/rancher-catalog-service/issues/events{/number}","events_url":"https://api.github.com/repos/rancher/rancher-catalog-service/events","assignees_url":"https://api.github.com/repos/rancher/rancher-catalog-service/assignees{/user}","branches_url":"https://api.github.com/repos/rancher/rancher-catalog-service/branches{/branch}","tags_url":"https://api.github.com/repos/rancher/rancher-catalog-service/tags","blobs_url":"https://api.github.com/repos/rancher/rancher-catalog-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rancher/rancher-catalog-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rancher/rancher-catalog-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/rancher/rancher-catalog-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rancher/rancher-catalog-service/statuses/{sha}","languages_url":"https://api.github.com/repos/rancher/rancher-catalog-service/languages","stargazers_url":"https://api.github.com/repos/rancher/rancher-catalog-service/stargazers","contributors_url":"https://api.github.com/repos/rancher/rancher-catalog-service/contributors","subscribers_url":"https://api.github.com/repos/rancher/rancher-catalog-service/subscribers","subscription_url":"https://api.github.com/repos/rancher/rancher-catalog-service/subscription","commits_url":"https://api.github.com/repos/rancher/rancher-catalog-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/rancher/rancher-catalog-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/rancher/rancher-catalog-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/rancher/rancher-catalog-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/rancher/rancher-catalog-service/contents/{+path}","compare_url":"https://api.github.com/repos/rancher/rancher-catalog-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rancher/rancher-catalog-service/merges","archive_url":"https://api.github.com/repos/rancher/rancher-catalog-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rancher/rancher-catalog-service/downloads","issues_url":"https://api.github.com/repos/rancher/rancher-catalog-service/issues{/number}","pulls_url":"https://api.github.com/repos/rancher/rancher-catalog-service/pulls{/number}","milestones_url":"https://api.github.com/repos/rancher/rancher-catalog-service/milestones{/number}","notifications_url":"https://api.github.com/repos/rancher/rancher-catalog-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rancher/rancher-catalog-service/labels{/name}","releases_url":"https://api.github.com/repos/rancher/rancher-catalog-service/releases{/id}","deployments_url":"https://api.github.com/repos/rancher/rancher-catalog-service/deployments","created_at":"2015-10-08T21:31:24Z","updated_at":"2016-07-01T17:37:33Z","pushed_at":"2016-07-12T06:49:25Z","git_url":"git://github.com/rancher/rancher-catalog-service.git","ssh_url":"git@github.com:rancher/rancher-catalog-service.git","clone_url":"https://github.com/rancher/rancher-catalog-service.git","svn_url":"https://github.com/rancher/rancher-catalog-service","homepage":"","size":444,"stargazers_count":4,"watchers_count":4,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":3,"forks":14,"open_issues":3,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rancher/rancher-catalog-service/pulls/55"},"html":{"href":"https://github.com/rancher/rancher-catalog-service/pull/55"},"issue":{"href":"https://api.github.com/repos/rancher/rancher-catalog-service/issues/55"},"comments":{"href":"https://api.github.com/repos/rancher/rancher-catalog-service/issues/55/comments"},"review_comments":{"href":"https://api.github.com/repos/rancher/rancher-catalog-service/pulls/55/comments"},"review_comment":{"href":"https://api.github.com/repos/rancher/rancher-catalog-service/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rancher/rancher-catalog-service/pulls/55/commits"},"statuses":{"href":"https://api.github.com/repos/rancher/rancher-catalog-service/statuses/a3fc9d0ca2b7a0b6419a7fc114e8d5925d6c07a8"}}}}
{"actor":{"display_login":"vincent99"}}