Exemple #1
0
 def __setup_user_group(self):
   """
   Creates PXF user with the required groups and bash as default shell
   """
   import params
   User(params.pxf_user,
        groups=[params.hdfs_superuser_group, params.user_group, params.tomcat_group],
        shell="/bin/bash")
Exemple #2
0
    def configure(self, env, upgrade_type=None):
        import params
        env.set_params(params)
        User(params.logfeeder_user,
             groups=[params.user_group,
                     grp.getgrgid(os.getegid()).gr_name],
             fetch_nonlocal_groups=params.fetch_nonlocal_groups)

        setup_logfeeder()
Exemple #3
0
def __create_hawq_user_secured():
  """
  Creates HAWQ secured headless user belonging to hadoop group.
  """
  import params
  Group(hawq_constants.hawq_group_secured, ignore_failures=True)

  User(hawq_constants.hawq_user_secured,
       gid=hawq_constants.hawq_group_secured,
       groups=[hawq_constants.hawq_group_secured, params.user_group],
       ignore_failures=True)
Exemple #4
0
def __create_hawq_user():
  """
  Creates HAWQ user with password and default group.
  """
  import params
  Group(hawq_constants.hawq_group, ignore_failures=True)

  User(hawq_constants.hawq_user,
       gid=hawq_constants.hawq_group,
       password=crypt.crypt(params.hawq_password, "$1$salt$"),
       groups=[hawq_constants.hawq_group, params.user_group],
       ignore_failures=True)
Exemple #5
0
def __create_hawq_user():
    """
  Creates HAWQ user with default password and group.
  """
    import params
    Group(constants.hawq_group, ignore_failures=True)

    User(constants.hawq_user,
         gid=constants.hawq_group,
         password=crypt.crypt(constants.hawq_password, "salt"),
         groups=[constants.hawq_group, params.user_group],
         ignore_failures=True)
Exemple #6
0
    def install_activity_analyzer(self):
        import params
        import grp

        if 'ignore_groupsusers_create' in params.config['configurations'][
                'cluster-env']:
            print(
                'ignore_groupsusers_create', params.config['configurations']
                ['cluster-env']['ignore_groupsusers_create'])

        if 'ignore_groupsusers_create' in params.config['configurations'][
                'cluster-env'] and (
                    params.config['configurations']['cluster-env']
                    ['ignore_groupsusers_create'] == True
                    or str(params.config['configurations']['cluster-env']
                           ['ignore_groupsusers_create']).lower() == 'true'):
            print(
                "Skipping activity analyzer user creation as specified by ambari config 'ignore_groupsusers_create'. Please make sure following user is created on NameNode."
            )
            print(
                "User Id: " + params.config['configurations']['activity-conf']
                ['global.activity.analyzer.user'] + "; group : " +
                params.config['configurations']['cluster-env']['user_group'])
        else:
            if 'hadoop-env' in params.config[
                    'configurations'] and 'hdfs_user' in params.config[
                        'configurations']['hadoop-env']:
                try:
                    g = grp.getgrnam(params.config['configurations']
                                     ['hadoop-env']['hdfs_user'])
                    User(params.config['configurations']['activity-conf']
                         ['global.activity.analyzer.user'],
                         gid=params.config['configurations']['cluster-env']
                         ['user_group'],
                         groups=params.config['configurations']['hadoop-env']
                         ['hdfs_user'])
                    print(
                        "Created user with additional group " +
                        str(params.config['configurations']['hadoop-env']
                            ['hdfs_user']))
                except KeyError:
                    User(params.config['configurations']['activity-conf']
                         ['global.activity.analyzer.user'],
                         gid=params.config['configurations']['cluster-env']
                         ['user_group'])
                    print(
                        "Created user without additional group " +
                        str(params.config['configurations']['hadoop-env']
                            ['hdfs_user']))
            else:
                User(params.config['configurations']['activity-conf']
                     ['global.activity.analyzer.user'],
                     gid=params.config['configurations']['cluster-env']
                     ['user_group'])
                print("Created user without hdfs group ")

        user, group = self.get_owner_user_and_group()
        init_d_dir = "/etc/rc.d/init.d"
        distname, version = utils.get_os()
        if distname.startswith('sles') or distname.startswith('suse'):
            init_d_dir = "/etc/init.d"
        cmd = "{sudo} /usr/sbin/hst activity-analyzer setup " + user + ":" + group + " '" + init_d_dir + "'"
        print("Deploying activity analyzer")
        exit_code, output, error = self.execute_command(cmd)