You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2013/02/19 10:11:23 UTC
[1/5] git commit: Core: The server will now exit when there are
pending migrations
Core: The server will now exit when there are pending migrations
+ Added missing licenses to deltacloud-db-upgrade and mock_initialize
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/92cf8dd4
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/92cf8dd4
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/92cf8dd4
Branch: refs/heads/master
Commit: 92cf8dd4d6e87c28b4c502ff97ccd06fd24394d5
Parents: fd4e4af
Author: Michal Fojtik <mf...@redhat.com>
Authored: Tue Feb 19 10:07:21 2013 +0100
Committer: Michal fojtik <mf...@redhat.com>
Committed: Tue Feb 19 10:10:57 2013 +0100
----------------------------------------------------------------------
server/bin/deltacloud-db-upgrade | 26 +++++++++++++------
server/lib/initializers/database_initialize.rb | 26 ++++++++++++++++---
server/lib/initializers/mock_initialize.rb | 15 +++++++++++
3 files changed, 55 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/92cf8dd4/server/bin/deltacloud-db-upgrade
----------------------------------------------------------------------
diff --git a/server/bin/deltacloud-db-upgrade b/server/bin/deltacloud-db-upgrade
index 5b37bbb..1a3a7b4 100755
--- a/server/bin/deltacloud-db-upgrade
+++ b/server/bin/deltacloud-db-upgrade
@@ -1,17 +1,27 @@
#!/usr/bin/env ruby
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you 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 'rubygems'
require 'require_relative' if RUBY_VERSION < '1.9'
+# Do not exit
+ENV['DB_UPGRADE'] = 'true'
+
require_relative './../lib/initializers/mock_initialize'
require_relative './../lib/initializers/database_initialize'
-# The DATABASE_UPGRADE constant is set to true if we have discovered
-# pending migrations in DATABASE_MIGRATIONS_DIR.
-#
-
-if DATABASE_UPGRADE
- puts "Upgrading database schema to the latest version..."
- Sequel::Migrator.apply(DATABASE, DATABASE_MIGRATIONS_DIR)
-end
+Sequel::Migrator.apply(DATABASE, DATABASE_MIGRATIONS_DIR)
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/92cf8dd4/server/lib/initializers/database_initialize.rb
----------------------------------------------------------------------
diff --git a/server/lib/initializers/database_initialize.rb b/server/lib/initializers/database_initialize.rb
index ae9d247..31af21c 100644
--- a/server/lib/initializers/database_initialize.rb
+++ b/server/lib/initializers/database_initialize.rb
@@ -1,3 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you 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.
+
# Initialize the storage layer we use to persist some CIMI entities
# and attributes.
#
@@ -38,8 +53,11 @@ DATABASE = Deltacloud::initialize_database
DATABASE_MIGRATIONS_DIR = File.join(File.dirname(__FILE__), '..', '..', 'db', 'migrations')
unless Sequel::Migrator.is_current?(DATABASE, DATABASE_MIGRATIONS_DIR)
- warn "WARNING: The database needs to be upgraded. Run: 'deltacloud-db-upgrade' command."
- DATABASE_UPGRADE = true
-else
- DATABASE_UPGRADE = false
+ # Do not exit when this intitializer is included from deltacloud-db-upgrade
+ # script
+ #
+ unless ENV['DB_UPGRADE']
+ warn "WARNING: The database needs to be upgraded. Run: 'deltacloud-db-upgrade' command."
+ exit(1)
+ end
end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/92cf8dd4/server/lib/initializers/mock_initialize.rb
----------------------------------------------------------------------
diff --git a/server/lib/initializers/mock_initialize.rb b/server/lib/initializers/mock_initialize.rb
index c8c24e9..058ffa9 100644
--- a/server/lib/initializers/mock_initialize.rb
+++ b/server/lib/initializers/mock_initialize.rb
@@ -1,3 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you 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.
+
# This will create the directory we use for storing Mock driver
# data and also CIMI database file
#