[MediaWiki-commits] [Gerrit] operations/puppet[production]: Puppet panel: Add per-prefix config tabs

2016-09-14 Thread Andrew Bogott (Code Review)
Andrew Bogott has submitted this change and it was merged.

Change subject: Puppet panel:  Add per-prefix config tabs
..


Puppet panel:  Add per-prefix config tabs

This is a roughed-in design with a few placeholder tabs.

Bug: T91990
Change-Id: If6bde5b11b2a3e10fd0760f4cb3fb87532cbace6
---
A modules/openstack/files/liberty/horizon/puppet_prefix_tab_enable.py
A modules/openstack/files/liberty/horizon/puppettab/prefixpanel/__init__.py
A modules/openstack/files/liberty/horizon/puppettab/prefixpanel/plustab.py
A modules/openstack/files/liberty/horizon/puppettab/prefixpanel/prefixpanel.py
A modules/openstack/files/liberty/horizon/puppettab/prefixpanel/urls.py
M modules/openstack/files/liberty/horizon/puppettab/tab.py
A 
modules/openstack/files/liberty/horizon/puppettab/templates/puppet/plus_tab.html
A 
modules/openstack/files/liberty/horizon/puppettab/templates/puppet/prefix_panel.html
M modules/openstack/manifests/horizon/puppetpanel.pp
9 files changed, 243 insertions(+), 4 deletions(-)

Approvals:
  Andrew Bogott: Looks good to me, approved
  jenkins-bot: Verified



diff --git 
a/modules/openstack/files/liberty/horizon/puppet_prefix_tab_enable.py 
b/modules/openstack/files/liberty/horizon/puppet_prefix_tab_enable.py
new file mode 100644
index 000..4764131
--- /dev/null
+++ b/modules/openstack/files/liberty/horizon/puppet_prefix_tab_enable.py
@@ -0,0 +1,5 @@
+PANEL = 'prefixpuppetpanel'
+PANEL_GROUP = 'puppet'
+PANEL_DASHBOARD = 'project'
+ADD_PANEL = ('wikimediapuppettab.prefixpanel.prefixpanel.PrefixPuppetPanel')
+AUTO_DISCOVER_STATIC_FILES = True
diff --git 
a/modules/openstack/files/liberty/horizon/puppettab/prefixpanel/__init__.py 
b/modules/openstack/files/liberty/horizon/puppettab/prefixpanel/__init__.py
new file mode 100644
index 000..e69de29
--- /dev/null
+++ b/modules/openstack/files/liberty/horizon/puppettab/prefixpanel/__init__.py
diff --git 
a/modules/openstack/files/liberty/horizon/puppettab/prefixpanel/plustab.py 
b/modules/openstack/files/liberty/horizon/puppettab/prefixpanel/plustab.py
new file mode 100644
index 000..f4fdc4f
--- /dev/null
+++ b/modules/openstack/files/liberty/horizon/puppettab/prefixpanel/plustab.py
@@ -0,0 +1,50 @@
+# Copyright (c) 2016 Andrew Bogott for Wikimedia Foundation
+# All Rights Reserved.
+#
+#Licensed under the Apache License, Version 2.0 (the "License"); you may
+#not use this file except in compliance with the License. You may obtain
+#a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing, software
+#distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#License for the specific language governing permissions and limitations
+#under the License.
+
+import logging
+
+from django import template
+from django.template.loader import render_to_string
+from django.utils.translation import ugettext_lazy as _
+
+from horizon import tabs
+
+logging.basicConfig()
+LOG = logging.getLogger(__name__)
+
+
+class PlusTab(tabs.Tab):
+name = _("+")
+slug = "puppetprefixplus"
+template_name = "project/puppet/plus_tab.html"
+prefix_name = False
+
+def __init__(self, *args, **kwargs):
+if 'tenant_id' in kwargs:
+self.tenant_id = kwargs['tenant_id']
+del kwargs['tenant_id']
+
+super(PlusTab, self).__init__(*args, **kwargs)
+
+def render(self):
+LOG.warning("rendering, and logging is working")
+context = template.RequestContext(self.request)
+context['prefix_name'] = self.prefix_name
+return render_to_string(self.get_template_name(self.request),
+self.data, context_instance=context)
+
+def post(self, request, *args, **kwargs):
+LOG.warning("We've got POST!")
+self.prefix_name = request.POST["prefix_name"]
diff --git 
a/modules/openstack/files/liberty/horizon/puppettab/prefixpanel/prefixpanel.py 
b/modules/openstack/files/liberty/horizon/puppettab/prefixpanel/prefixpanel.py
new file mode 100644
index 000..4bb05b4
--- /dev/null
+++ 
b/modules/openstack/files/liberty/horizon/puppettab/prefixpanel/prefixpanel.py
@@ -0,0 +1,88 @@
+# Copyright (c) 2016 Andrew Bogott for Wikimedia Foundation
+# All Rights Reserved.
+#
+#Licensed under the Apache License, Version 2.0 (the "License"); you may
+#not use this file except in compliance with the License. You may obtain
+#a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing, software
+#distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#License for the specific language governing 

[MediaWiki-commits] [Gerrit] operations/puppet[production]: Puppet panel: Add per-prefix config tabs

2016-09-14 Thread Andrew Bogott (Code Review)
Andrew Bogott has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/310683

Change subject: Puppet panel:  Add per-prefix config tabs
..

Puppet panel:  Add per-prefix config tabs

This is a roughed-in design with a few placeholder tabs.

Bug: T91990
Change-Id: If6bde5b11b2a3e10fd0760f4cb3fb87532cbace6
---
A modules/openstack/files/liberty/horizon/puppet_prefix_tab_enable.py
A modules/openstack/files/liberty/horizon/puppettab/prefixpanel/__init__.py
A modules/openstack/files/liberty/horizon/puppettab/prefixpanel/plustab.py
A modules/openstack/files/liberty/horizon/puppettab/prefixpanel/prefixpanel.py
A modules/openstack/files/liberty/horizon/puppettab/prefixpanel/urls.py
M modules/openstack/files/liberty/horizon/puppettab/tab.py
A 
modules/openstack/files/liberty/horizon/puppettab/templates/puppet/plus_tab.html
A 
modules/openstack/files/liberty/horizon/puppettab/templates/puppet/prefix_panel.html
M modules/openstack/manifests/horizon/puppetpanel.pp
9 files changed, 244 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/83/310683/1

diff --git 
a/modules/openstack/files/liberty/horizon/puppet_prefix_tab_enable.py 
b/modules/openstack/files/liberty/horizon/puppet_prefix_tab_enable.py
new file mode 100644
index 000..e90fae1
--- /dev/null
+++ b/modules/openstack/files/liberty/horizon/puppet_prefix_tab_enable.py
@@ -0,0 +1,6 @@
+PANEL = 'prefixpuppetpanel'
+PANEL_GROUP = 'puppet'
+PANEL_DASHBOARD = 'project'
+ADD_PANEL = ('wikimediapuppettab.prefixpanel.prefixpanel.PrefixPuppetPanel')
+AUTO_DISCOVER_STATIC_FILES = True
+
diff --git 
a/modules/openstack/files/liberty/horizon/puppettab/prefixpanel/__init__.py 
b/modules/openstack/files/liberty/horizon/puppettab/prefixpanel/__init__.py
new file mode 100644
index 000..e69de29
--- /dev/null
+++ b/modules/openstack/files/liberty/horizon/puppettab/prefixpanel/__init__.py
diff --git 
a/modules/openstack/files/liberty/horizon/puppettab/prefixpanel/plustab.py 
b/modules/openstack/files/liberty/horizon/puppettab/prefixpanel/plustab.py
new file mode 100644
index 000..f4fdc4f
--- /dev/null
+++ b/modules/openstack/files/liberty/horizon/puppettab/prefixpanel/plustab.py
@@ -0,0 +1,50 @@
+# Copyright (c) 2016 Andrew Bogott for Wikimedia Foundation
+# All Rights Reserved.
+#
+#Licensed under the Apache License, Version 2.0 (the "License"); you may
+#not use this file except in compliance with the License. You may obtain
+#a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing, software
+#distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#License for the specific language governing permissions and limitations
+#under the License.
+
+import logging
+
+from django import template
+from django.template.loader import render_to_string
+from django.utils.translation import ugettext_lazy as _
+
+from horizon import tabs
+
+logging.basicConfig()
+LOG = logging.getLogger(__name__)
+
+
+class PlusTab(tabs.Tab):
+name = _("+")
+slug = "puppetprefixplus"
+template_name = "project/puppet/plus_tab.html"
+prefix_name = False
+
+def __init__(self, *args, **kwargs):
+if 'tenant_id' in kwargs:
+self.tenant_id = kwargs['tenant_id']
+del kwargs['tenant_id']
+
+super(PlusTab, self).__init__(*args, **kwargs)
+
+def render(self):
+LOG.warning("rendering, and logging is working")
+context = template.RequestContext(self.request)
+context['prefix_name'] = self.prefix_name
+return render_to_string(self.get_template_name(self.request),
+self.data, context_instance=context)
+
+def post(self, request, *args, **kwargs):
+LOG.warning("We've got POST!")
+self.prefix_name = request.POST["prefix_name"]
diff --git 
a/modules/openstack/files/liberty/horizon/puppettab/prefixpanel/prefixpanel.py 
b/modules/openstack/files/liberty/horizon/puppettab/prefixpanel/prefixpanel.py
new file mode 100644
index 000..4bb05b4
--- /dev/null
+++ 
b/modules/openstack/files/liberty/horizon/puppettab/prefixpanel/prefixpanel.py
@@ -0,0 +1,88 @@
+# Copyright (c) 2016 Andrew Bogott for Wikimedia Foundation
+# All Rights Reserved.
+#
+#Licensed under the Apache License, Version 2.0 (the "License"); you may
+#not use this file except in compliance with the License. You may obtain
+#a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing, software
+#distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#License