Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

first commit

  • Loading branch information...
commit a56fbc33ae152e150d99311102de46ea3a59e923 0 parents
@ninja-cat ninja-cat authored
14 README.txt
@@ -0,0 +1,14 @@
+Welcome to a Barclamp for the Crowbar Framework project
+=======================================================
+
+The code and documentation is distributed under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html). Contributions back to the source are encouraged.
+
+The Crowbar Framework (https://github.com/dellcloudedge/crowbar) was developed by the Dell CloudEdge Solutions Team (http://dell.com/openstack) as a OpenStack installer (http://OpenStack.org) but has evolved as a much broader function tool.
+A Barclamp is a module component that implements functionality for Crowbar. Core barclamps operate the essential functions of the Crowbar deployment mechanics while other barclamps extend the system for specific applications.
+
+* This functonality of this barclamp DOES NOT stand alone, the Crowbar Framework is required *
+
+About this barclamp
+-------------------
+
+Information for this barclamp is maintained on the Crowbar Framework Wiki: https://github.com/dellcloudedge/crowbar/wiki
22 bin/crowbar_gitserver
@@ -0,0 +1,22 @@
+#!/usr/bin/env ruby
+# Copyright 2011, Dell
+# Copyright 2012, Dell
+#
+# 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.
+#
+
+
+require File.join(File.expand_path(File.dirname(__FILE__)), "barclamp_lib")
+@barclamp = "gitserver"
+
+main
8 chef/cookbooks/gitserver/README.rdoc
@@ -0,0 +1,8 @@
+= DESCRIPTION:
+
+= REQUIREMENTS:
+
+= ATTRIBUTES:
+
+= USAGE:
+
6 chef/cookbooks/gitserver/metadata.rb
@@ -0,0 +1,6 @@
+maintainer "Dell Inc."
+maintainer_email "agordeev@mirantis.com"
+license "All rights reserved"
+description "Installs/Configures gitserver"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+version "0.0.1"
20 chef/cookbooks/gitserver/recipes/config.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: gitserver
+# Recipe:: config
+#
+# Copyright 2011, Dell, Inc.
+# Copyright 2012, Dell, Inc.
+#
+# 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.
+#
+
21 chef/cookbooks/gitserver/recipes/install.rb
@@ -0,0 +1,21 @@
+#
+# Cookbook Name:: gitserver
+# Recipe:: install
+#
+# Copyright 2011, Dell, Inc.
+# Copyright 2012, Dell, Inc.
+#
+# 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.
+#
+
+package "git"
25 chef/data_bags/crowbar/bc-template-gitserver.json
@@ -0,0 +1,25 @@
+{
+ "id": "bc-template-gitserver",
+ "description": "provides a gitserver installation",
+ "attributes": {
+ },
+ "deployment": {
+ "gitserver": {
+ "crowbar-revision": 0,
+ "element_states": {
+ "gitserver": [ "readying", "ready", "applying" ]
+ },
+ "elements": {},
+ "element_order": [
+ [ "gitserver" ]
+ ],
+ "config": {
+ "environment": "gitserver-base-config",
+ "mode": "full",
+ "transitions": false,
+ "transition_list": []
+ }
+ }
+ }
+}
+
72 chef/data_bags/crowbar/bc-template-gitserver.schema
@@ -0,0 +1,72 @@
+{
+ "type": "map",
+ "required": true,
+ "mapping": {
+ "id": { "type": "str", "required": true, "pattern": "/^bc-gitserver-|^bc-template-gitserver$/" },
+ "description": { "type": "str", "required": true },
+ "attributes": {
+ "type": "map",
+ "required": true,
+ "mapping": {
+ }
+ },
+ "deployment": {
+ "type": "map",
+ "required": true,
+ "mapping": {
+ "gitserver": {
+ "type": "map",
+ "required": true,
+ "mapping": {
+ "crowbar-revision": { "type": "int", "required": true },
+ "crowbar-committing": { "type": "bool" },
+ "crowbar-queued": { "type": "bool" },
+ "element_states": {
+ "type": "map",
+ "mapping": {
+ = : {
+ "type": "seq",
+ "required": true,
+ "sequence": [ { "type": "str" } ]
+ }
+ }
+ },
+ "elements": {
+ "type": "map",
+ "required": true,
+ "mapping": {
+ = : {
+ "type": "seq",
+ "required": true,
+ "sequence": [ { "type": "str" } ]
+ }
+ }
+ },
+ "element_order": {
+ "type": "seq",
+ "required": true,
+ "sequence": [ {
+ "type": "seq",
+ "sequence": [ { "type": "str" } ]
+ } ]
+ },
+ "config": {
+ "type": "map",
+ "required": true,
+ "mapping": {
+ "environment": { "type": "str", "required": true },
+ "mode": { "type": "str", "required": true },
+ "transitions": { "type": "bool", "required": true },
+ "transition_list": {
+ "type": "seq",
+ "required": true,
+ "sequence": [ { "type": "str" } ]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
8 chef/roles/gitserver.rb
@@ -0,0 +1,8 @@
+name "gitserver"
+description "Gitserver Role - does git repos hosting via ssh"
+run_list(
+ "recipe[gitserver::install]",
+ "recipe[gitserver::config]"
+)
+default_attributes()
+override_attributes()
31 crowbar.yml
@@ -0,0 +1,31 @@
+# Copyright 2011, Dell
+# Copyright 2012, Dell
+#
+# 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.
+#
+# Author: RobHirschfeld
+
+barclamp:
+ name: gitserver
+ display: Gitserver
+ version: 0
+
+crowbar:
+ layout: 1
+ order: 99
+ run_order: 99
+ chef_order: 99
+
+debs:
+ pkgs:
+ - git
22 crowbar_framework/app/controllers/gitserver_controller.rb
@@ -0,0 +1,22 @@
+# Copyright 2011, Dell
+# Copyright 2012, Dell
+#
+# 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.
+#
+
+class GitserverController < BarclampController
+ def initialize
+ @service_object = GitserverService.new logger
+ end
+
+end
45 crowbar_framework/app/models/gitserver_service.rb
@@ -0,0 +1,45 @@
+# Copyright 2011, Dell
+# Copyright 2012, Dell
+#
+# 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.
+#
+
+class GitserverService < ServiceObject
+ class ServiceError < StandardError
+ end
+
+ def initialize(thelogger)
+ @bc_name = "gitserver"
+ @logger = thelogger
+ end
+
+ def create_proposal
+ # TODO: ensure that only one proposal can be applied to a node
+ @logger.debug("Gitserver create_proposal: entering")
+ base = super
+ @logger.debug("Gitserver create_proposal: leaving base part")
+
+ nodes = NodeObject.find()
+ nodes.delete_if { |n| n.nil? or n.admin? }
+ unless nodes.empty?
+ base["deployment"]["gitserver"]["elements"] = {
+ "gitserver" => [ nodes.first.name ]
+ }
+ end
+
+ @logger.debug("Gitserver create_proposal: exiting")
+ base
+ end
+
+end
+
5 crowbar_framework/app/views/barclamp/gitserver/_edit_attributes.html.haml
@@ -0,0 +1,5 @@
+
+%input#proposal_attributes{:type => "hidden", :name => "proposal_attributes", :value => @proposal.raw_data['attributes'][@proposal.barclamp].to_json}
+%p
+ %label{:for => "proposal_attributes"}= t('.attributes')
+ = link_to t('raw'), proposal_barclamp_path(:id => @proposal.name, :controller => @proposal.barclamp, :dep_raw => @dep_raw, :attr_raw => true), :style => "float: right;"
10 crowbar_framework/app/views/barclamp/gitserver/_edit_deployment.html.haml
@@ -0,0 +1,10 @@
+
+%p
+ = render :partial => "barclamp/node_selector"
+
+:javascript
+ $(document).ready(function(){
+ var constraints = { "gitserver": { "unique": false, "count": 1 } };
+ node_selector($('#drag_drop'), constraints);
+ });
+
Please sign in to comment.
Something went wrong with that request. Please try again.