You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ma...@apache.org on 2012/11/07 09:19:56 UTC

svn commit: r1406491 [2/5] - in /incubator/ambari/branches/AMBARI-666: ./ ambari-agent/src/main/puppet/modules/hdp-repos/ ambari-agent/src/main/puppet/modules/hdp-repos/manifests/ ambari-agent/src/main/puppet/modules/hdp-repos/templates/ ambari-agent/s...

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Resource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Resource.java?rev=1406491&r1=1406490&r2=1406491&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Resource.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Resource.java Wed Nov  7 08:19:54 2012
@@ -81,6 +81,7 @@ public interface Resource {
     Configuration,
     Action,
     Request,
-    Task
+    Task,
+    User
   }
 }

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java?rev=1406491&r1=1406490&r2=1406491&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java Wed Nov  7 08:19:54 2012
@@ -205,12 +205,15 @@ public class PropertyHelper {
   public static String fixHostName(String host) {
     int first_dash = host.indexOf('-');
     int first_dot = host.indexOf('.');
-    String segment1 = host.substring(0, first_dash);
-    if (segment1.equals("domu")) {
-      segment1 = "domU";
+
+    if (first_dash > -1 && first_dot > -1) {
+      String segment1 = host.substring(0, first_dash);
+      if (segment1.equals("domu")) {
+        segment1 = "domU";
+      }
+      String segment2 = host.substring(first_dash, first_dot).toUpperCase();
+      host = segment1 + segment2 + host.substring(first_dot);
     }
-    String segment2 = host.substring(first_dash, first_dot).toUpperCase();
-    host = segment1 + segment2 + host.substring(first_dot);
     return host;
   }
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java?rev=1406491&r1=1406490&r2=1406491&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java Wed Nov  7 08:19:54 2012
@@ -17,9 +17,10 @@
  */
 package org.apache.ambari.server.security.authorization;
 
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.google.inject.persist.Transactional;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.orm.dao.RoleDAO;
@@ -29,9 +30,9 @@ import org.apache.ambari.server.orm.enti
 import org.apache.ambari.server.orm.entities.UserEntityPK;
 import org.springframework.security.crypto.password.PasswordEncoder;
 
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.persist.Transactional;
 
 /**
  * Provides high-level access to Users and Roles in database
@@ -59,6 +60,15 @@ public class Users {
 
     return users;
   }
+  
+  public User getAnyUser(String userName) {
+    UserEntity userEntity = userDAO.findLdapUserByName(userName);
+    if (null == userEntity) {
+      userEntity = userDAO.findLocalUserByName(userName);
+    }
+    
+    return (null == userEntity) ? null : new User(userEntity);
+  }
 
   public User getLocalUser(String userName) throws AmbariException{
     UserEntity userEntity = userDAO.findLocalUserByName(userName);

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/Ambari-DDL.sql
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/Ambari-DDL.sql?rev=1406491&r1=1406490&r2=1406491&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/Ambari-DDL.sql (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/Ambari-DDL.sql Wed Nov  7 08:19:54 2012
@@ -1,21 +1,20 @@
-/**
- * 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.
- */
--- Schema: ambari
+--
+-- 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.
+--
 
 DROP SCHEMA IF EXISTS ambari CASCADE;
 
@@ -73,7 +72,7 @@ CREATE TABLE Hosts
 host_name VARCHAR NOT NULL,
 ipv4 VARCHAR UNIQUE,
 ipv6 VARCHAR UNIQUE,
-total_mem INTEGER DEFAULT '0' NOT NULL,
+total_mem BIGINT DEFAULT '0' NOT NULL,
 cpu_count INTEGER DEFAULT '0' NOT NULL,
 cpu_info VARCHAR DEFAULT '' NOT NULL,
 os_arch VARCHAR DEFAULT '' NOT NULL,
@@ -81,7 +80,7 @@ disks_info VARCHAR DEFAULT '' NOT NULL,
 os_info VARCHAR DEFAULT '' NOT NULL,
 os_type VARCHAR DEFAULT '' NOT NULL,
 discovery_status VARCHAR DEFAULT '' NOT NULL,
-last_registration_time INTEGER DEFAULT '0' NOT NULL,
+last_registration_time BIGINT DEFAULT '0' NOT NULL,
 rack_info VARCHAR DEFAULT '/default-rack' NOT NULL,
 host_attributes VARCHAR DEFAULT '' NOT NULL,
 PRIMARY KEY (host_name)
@@ -239,7 +238,7 @@ CREATE TABLE STAGE
 
 CREATE TABLE HOST_ROLE_COMMAND
 (
-   task_id SERIAL NOT NULL,
+   task_id BIGSERIAL NOT NULL,
    request_id BIGINT NOT NULL,
    stage_id BIGINT NOT NULL,
    host_name VARCHAR DEFAULT '' NOT NULL references Hosts(host_name),
@@ -259,7 +258,7 @@ CREATE TABLE HOST_ROLE_COMMAND
 
 CREATE TABLE EXECUTION_COMMAND
 (
-   task_id INTEGER DEFAULT '0' NOT NULL references HOST_ROLE_COMMAND(task_id),
+   task_id BIGINT DEFAULT '0' NOT NULL references HOST_ROLE_COMMAND(task_id),
    command VARCHAR NOT NULL, /** Serialized ExecutionCommand **/
    PRIMARY KEY(task_id)
 );