{"action":"created","comment":{"url":"https://api.github.com/repos/cockpit-project/cockpit/pulls/comments/41617416","id":41617416,"diff_hunk":"@@ -709,13 +755,107 @@ PageSystemInformationChangeSystime.prototype = {\n            .done(parse_timezones);\n     },\n \n+    get_ntp_servers: function() {\n+        var self = this;\n+\n+        /* We only support editing the configuration of\n+         * systemd-timesyncd, by dropping a file into\n+         * /etc/systemd/timesyncd.conf.d.  We assume that timesyncd is\n+         * used when:\n+         *\n+         * - systemd-timedated is answering for\n+         *   org.freedesktop.timedate1 as opposed to, say, timedatex.\n+         *\n+         * - systemd-timesyncd is actually available.\n+         *\n+         * The better alternative would be to have an API in\n+         * o.fd.timedate1 for managing the list of NTP server\n+         * candidates.\n+         */\n+\n+        var checked = false;\n+\n+        $([ self.timedate1_service, self.timesyncd_service ]).on(\"changed\", function () {\n+            if (!checked &&\n+                (self.timedate1_service.exists === false || self.timedate1_service.unit) &&\n+                (self.timesyncd_service.exists !== null)) {\n+\n+                checked = true;\n+\n+                if (!self.timedate1_service.exists || self.timedate1_service.unit.Id !== \"systemd-timedated.service\") {\n+                    console.log(\"systemd-timedated not in use, ntp server configuration not supported\");\n+                    return;\n+                }\n+\n+                if (!self.timesyncd_service.exists) {\n+                    console.log(\"systemd-timesyncd not available, ntp server configuration not supported\");\n+                    return;\n+                }\n+\n+                if (!self.ntp_config_file)\n+                    self.ntp_config_file = cockpit.file(\"/etc/systemd/timesyncd.conf.d/50-cockpit.conf\",\n+                                                        { superuser: \"try\" });\n+\n+                self.ntp_config_file.read().\n+                    done(function (text) {\n+                        if (text === null)\n+                            self.ntp_servers = [ ];\n+                        else {\n+                            text.split(\"\\n\").forEach(function (line) {\n+                                if (line.indexOf(\"NTP=\") === 0)\n+                                    self.ntp_servers = line.slice(4).split(\" \").filter(function (val) {\n+                                        return val !== \"\";\n+                                    });\n+                            });\n+                        }\n+                        if (self.ntp_servers.length === 0)\n+                            self.ntp_servers = [ \"\" ];\n+                        self.update_ntp_servers();\n+                        self.update_ntp_status();\n+                        self.update();\n+                    }).\n+                    fail(function (error) {\n+                        console.log(\"error\", error);","path":"pkg/systemd/host.js","position":164,"original_position":164,"commit_id":"07e9528acc2276ee753a89466dd65cc76e7780ef","original_commit_id":"07e9528acc2276ee753a89466dd65cc76e7780ef","user":{"login":"mvollmer","id":3228183,"avatar_url":"https://avatars.githubusercontent.com/u/3228183?v=3","gravatar_id":"","url":"https://api.github.com/users/mvollmer","html_url":"https://github.com/mvollmer","followers_url":"https://api.github.com/users/mvollmer/followers","following_url":"https://api.github.com/users/mvollmer/following{/other_user}","gists_url":"https://api.github.com/users/mvollmer/gists{/gist_id}","starred_url":"https://api.github.com/users/mvollmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvollmer/subscriptions","organizations_url":"https://api.github.com/users/mvollmer/orgs","repos_url":"https://api.github.com/users/mvollmer/repos","events_url":"https://api.github.com/users/mvollmer/events{/privacy}","received_events_url":"https://api.github.com/users/mvollmer/received_events","type":"User","site_admin":false},"body":"Yes, much better.\r\n","created_at":"2015-10-09T10:35:26Z","updated_at":"2015-10-09T10:35:26Z","html_url":"https://github.com/cockpit-project/cockpit/pull/2909#discussion_r41617416","pull_request_url":"https://api.github.com/repos/cockpit-project/cockpit/pulls/2909","_links":{"self":{"href":"https://api.github.com/repos/cockpit-project/cockpit/pulls/comments/41617416"},"html":{"href":"https://github.com/cockpit-project/cockpit/pull/2909#discussion_r41617416"},"pull_request":{"href":"https://api.github.com/repos/cockpit-project/cockpit/pulls/2909"}}},"pull_request":{"url":"https://api.github.com/repos/cockpit-project/cockpit/pulls/2909","id":46896398,"html_url":"https://github.com/cockpit-project/cockpit/pull/2909","diff_url":"https://github.com/cockpit-project/cockpit/pull/2909.diff","patch_url":"https://github.com/cockpit-project/cockpit/pull/2909.patch","issue_url":"https://api.github.com/repos/cockpit-project/cockpit/issues/2909","number":2909,"state":"open","locked":false,"title":"systemd: Allow configuration of additional NTP servers.","user":{"login":"mvollmer","id":3228183,"avatar_url":"https://avatars.githubusercontent.com/u/3228183?v=3","gravatar_id":"","url":"https://api.github.com/users/mvollmer","html_url":"https://github.com/mvollmer","followers_url":"https://api.github.com/users/mvollmer/followers","following_url":"https://api.github.com/users/mvollmer/following{/other_user}","gists_url":"https://api.github.com/users/mvollmer/gists{/gist_id}","starred_url":"https://api.github.com/users/mvollmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvollmer/subscriptions","organizations_url":"https://api.github.com/users/mvollmer/orgs","repos_url":"https://api.github.com/users/mvollmer/repos","events_url":"https://api.github.com/users/mvollmer/events{/privacy}","received_events_url":"https://api.github.com/users/mvollmer/received_events","type":"User","site_admin":false},"body":"Note, when manually testing this, make sure that \"timedatex\" is not installed or when it is installed, that is is disabled (systemctl disable timedatex).  If it is enabled, the UI will not allow configuration of NTP servers.","created_at":"2015-10-06T12:32:31Z","updated_at":"2015-10-09T10:35:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"10f3b42ef09502de8ec32ea2258b72c52e33d70f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cockpit-project/cockpit/pulls/2909/commits","review_comments_url":"https://api.github.com/repos/cockpit-project/cockpit/pulls/2909/comments","review_comment_url":"https://api.github.com/repos/cockpit-project/cockpit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cockpit-project/cockpit/issues/2909/comments","statuses_url":"https://api.github.com/repos/cockpit-project/cockpit/statuses/07e9528acc2276ee753a89466dd65cc76e7780ef","head":{"label":"mvollmer:systemd-timesync","ref":"systemd-timesync","sha":"07e9528acc2276ee753a89466dd65cc76e7780ef","user":{"login":"mvollmer","id":3228183,"avatar_url":"https://avatars.githubusercontent.com/u/3228183?v=3","gravatar_id":"","url":"https://api.github.com/users/mvollmer","html_url":"https://github.com/mvollmer","followers_url":"https://api.github.com/users/mvollmer/followers","following_url":"https://api.github.com/users/mvollmer/following{/other_user}","gists_url":"https://api.github.com/users/mvollmer/gists{/gist_id}","starred_url":"https://api.github.com/users/mvollmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvollmer/subscriptions","organizations_url":"https://api.github.com/users/mvollmer/orgs","repos_url":"https://api.github.com/users/mvollmer/repos","events_url":"https://api.github.com/users/mvollmer/events{/privacy}","received_events_url":"https://api.github.com/users/mvollmer/received_events","type":"User","site_admin":false},"repo":{"id":20679941,"name":"cockpit","full_name":"mvollmer/cockpit","owner":{"login":"mvollmer","id":3228183,"avatar_url":"https://avatars.githubusercontent.com/u/3228183?v=3","gravatar_id":"","url":"https://api.github.com/users/mvollmer","html_url":"https://github.com/mvollmer","followers_url":"https://api.github.com/users/mvollmer/followers","following_url":"https://api.github.com/users/mvollmer/following{/other_user}","gists_url":"https://api.github.com/users/mvollmer/gists{/gist_id}","starred_url":"https://api.github.com/users/mvollmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvollmer/subscriptions","organizations_url":"https://api.github.com/users/mvollmer/orgs","repos_url":"https://api.github.com/users/mvollmer/repos","events_url":"https://api.github.com/users/mvollmer/events{/privacy}","received_events_url":"https://api.github.com/users/mvollmer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mvollmer/cockpit","description":"Cockpit, a user interface for GNU/Linux servers","fork":true,"url":"https://api.github.com/repos/mvollmer/cockpit","forks_url":"https://api.github.com/repos/mvollmer/cockpit/forks","keys_url":"https://api.github.com/repos/mvollmer/cockpit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mvollmer/cockpit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mvollmer/cockpit/teams","hooks_url":"https://api.github.com/repos/mvollmer/cockpit/hooks","issue_events_url":"https://api.github.com/repos/mvollmer/cockpit/issues/events{/number}","events_url":"https://api.github.com/repos/mvollmer/cockpit/events","assignees_url":"https://api.github.com/repos/mvollmer/cockpit/assignees{/user}","branches_url":"https://api.github.com/repos/mvollmer/cockpit/branches{/branch}","tags_url":"https://api.github.com/repos/mvollmer/cockpit/tags","blobs_url":"https://api.github.com/repos/mvollmer/cockpit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mvollmer/cockpit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mvollmer/cockpit/git/refs{/sha}","trees_url":"https://api.github.com/repos/mvollmer/cockpit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mvollmer/cockpit/statuses/{sha}","languages_url":"https://api.github.com/repos/mvollmer/cockpit/languages","stargazers_url":"https://api.github.com/repos/mvollmer/cockpit/stargazers","contributors_url":"https://api.github.com/repos/mvollmer/cockpit/contributors","subscribers_url":"https://api.github.com/repos/mvollmer/cockpit/subscribers","subscription_url":"https://api.github.com/repos/mvollmer/cockpit/subscription","commits_url":"https://api.github.com/repos/mvollmer/cockpit/commits{/sha}","git_commits_url":"https://api.github.com/repos/mvollmer/cockpit/git/commits{/sha}","comments_url":"https://api.github.com/repos/mvollmer/cockpit/comments{/number}","issue_comment_url":"https://api.github.com/repos/mvollmer/cockpit/issues/comments{/number}","contents_url":"https://api.github.com/repos/mvollmer/cockpit/contents/{+path}","compare_url":"https://api.github.com/repos/mvollmer/cockpit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mvollmer/cockpit/merges","archive_url":"https://api.github.com/repos/mvollmer/cockpit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mvollmer/cockpit/downloads","issues_url":"https://api.github.com/repos/mvollmer/cockpit/issues{/number}","pulls_url":"https://api.github.com/repos/mvollmer/cockpit/pulls{/number}","milestones_url":"https://api.github.com/repos/mvollmer/cockpit/milestones{/number}","notifications_url":"https://api.github.com/repos/mvollmer/cockpit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mvollmer/cockpit/labels{/name}","releases_url":"https://api.github.com/repos/mvollmer/cockpit/releases{/id}","created_at":"2014-06-10T09:35:54Z","updated_at":"2015-01-15T09:03:04Z","pushed_at":"2015-10-09T10:30:18Z","git_url":"git://github.com/mvollmer/cockpit.git","ssh_url":"git@github.com:mvollmer/cockpit.git","clone_url":"https://github.com/mvollmer/cockpit.git","svn_url":"https://github.com/mvollmer/cockpit","homepage":"http://www.cockpit-project.org/","size":25324,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"cockpit-project:master","ref":"master","sha":"3d91bd348fc03a835486b262c315f1a129a73623","user":{"login":"cockpit-project","id":5765104,"avatar_url":"https://avatars.githubusercontent.com/u/5765104?v=3","gravatar_id":"","url":"https://api.github.com/users/cockpit-project","html_url":"https://github.com/cockpit-project","followers_url":"https://api.github.com/users/cockpit-project/followers","following_url":"https://api.github.com/users/cockpit-project/following{/other_user}","gists_url":"https://api.github.com/users/cockpit-project/gists{/gist_id}","starred_url":"https://api.github.com/users/cockpit-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockpit-project/subscriptions","organizations_url":"https://api.github.com/users/cockpit-project/orgs","repos_url":"https://api.github.com/users/cockpit-project/repos","events_url":"https://api.github.com/users/cockpit-project/events{/privacy}","received_events_url":"https://api.github.com/users/cockpit-project/received_events","type":"Organization","site_admin":false},"repo":{"id":14049216,"name":"cockpit","full_name":"cockpit-project/cockpit","owner":{"login":"cockpit-project","id":5765104,"avatar_url":"https://avatars.githubusercontent.com/u/5765104?v=3","gravatar_id":"","url":"https://api.github.com/users/cockpit-project","html_url":"https://github.com/cockpit-project","followers_url":"https://api.github.com/users/cockpit-project/followers","following_url":"https://api.github.com/users/cockpit-project/following{/other_user}","gists_url":"https://api.github.com/users/cockpit-project/gists{/gist_id}","starred_url":"https://api.github.com/users/cockpit-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockpit-project/subscriptions","organizations_url":"https://api.github.com/users/cockpit-project/orgs","repos_url":"https://api.github.com/users/cockpit-project/repos","events_url":"https://api.github.com/users/cockpit-project/events{/privacy}","received_events_url":"https://api.github.com/users/cockpit-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cockpit-project/cockpit","description":"Cockpit, a user interface for Linux servers","fork":false,"url":"https://api.github.com/repos/cockpit-project/cockpit","forks_url":"https://api.github.com/repos/cockpit-project/cockpit/forks","keys_url":"https://api.github.com/repos/cockpit-project/cockpit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cockpit-project/cockpit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cockpit-project/cockpit/teams","hooks_url":"https://api.github.com/repos/cockpit-project/cockpit/hooks","issue_events_url":"https://api.github.com/repos/cockpit-project/cockpit/issues/events{/number}","events_url":"https://api.github.com/repos/cockpit-project/cockpit/events","assignees_url":"https://api.github.com/repos/cockpit-project/cockpit/assignees{/user}","branches_url":"https://api.github.com/repos/cockpit-project/cockpit/branches{/branch}","tags_url":"https://api.github.com/repos/cockpit-project/cockpit/tags","blobs_url":"https://api.github.com/repos/cockpit-project/cockpit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cockpit-project/cockpit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cockpit-project/cockpit/git/refs{/sha}","trees_url":"https://api.github.com/repos/cockpit-project/cockpit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cockpit-project/cockpit/statuses/{sha}","languages_url":"https://api.github.com/repos/cockpit-project/cockpit/languages","stargazers_url":"https://api.github.com/repos/cockpit-project/cockpit/stargazers","contributors_url":"https://api.github.com/repos/cockpit-project/cockpit/contributors","subscribers_url":"https://api.github.com/repos/cockpit-project/cockpit/subscribers","subscription_url":"https://api.github.com/repos/cockpit-project/cockpit/subscription","commits_url":"https://api.github.com/repos/cockpit-project/cockpit/commits{/sha}","git_commits_url":"https://api.github.com/repos/cockpit-project/cockpit/git/commits{/sha}","comments_url":"https://api.github.com/repos/cockpit-project/cockpit/comments{/number}","issue_comment_url":"https://api.github.com/repos/cockpit-project/cockpit/issues/comments{/number}","contents_url":"https://api.github.com/repos/cockpit-project/cockpit/contents/{+path}","compare_url":"https://api.github.com/repos/cockpit-project/cockpit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cockpit-project/cockpit/merges","archive_url":"https://api.github.com/repos/cockpit-project/cockpit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cockpit-project/cockpit/downloads","issues_url":"https://api.github.com/repos/cockpit-project/cockpit/issues{/number}","pulls_url":"https://api.github.com/repos/cockpit-project/cockpit/pulls{/number}","milestones_url":"https://api.github.com/repos/cockpit-project/cockpit/milestones{/number}","notifications_url":"https://api.github.com/repos/cockpit-project/cockpit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cockpit-project/cockpit/labels{/name}","releases_url":"https://api.github.com/repos/cockpit-project/cockpit/releases{/id}","created_at":"2013-11-01T17:36:46Z","updated_at":"2015-10-09T03:29:07Z","pushed_at":"2015-10-09T10:30:20Z","git_url":"git://github.com/cockpit-project/cockpit.git","ssh_url":"git@github.com:cockpit-project/cockpit.git","clone_url":"https://github.com/cockpit-project/cockpit.git","svn_url":"https://github.com/cockpit-project/cockpit","homepage":"http://www.cockpit-project.org/","size":41891,"stargazers_count":1253,"watchers_count":1253,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":141,"mirror_url":null,"open_issues_count":346,"forks":141,"open_issues":346,"watchers":1253,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cockpit-project/cockpit/pulls/2909"},"html":{"href":"https://github.com/cockpit-project/cockpit/pull/2909"},"issue":{"href":"https://api.github.com/repos/cockpit-project/cockpit/issues/2909"},"comments":{"href":"https://api.github.com/repos/cockpit-project/cockpit/issues/2909/comments"},"review_comments":{"href":"https://api.github.com/repos/cockpit-project/cockpit/pulls/2909/comments"},"review_comment":{"href":"https://api.github.com/repos/cockpit-project/cockpit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cockpit-project/cockpit/pulls/2909/commits"},"statuses":{"href":"https://api.github.com/repos/cockpit-project/cockpit/statuses/07e9528acc2276ee753a89466dd65cc76e7780ef"}}}}