original_docstring: Add a user to a group on OneFS and in the local group-creation script.
docstring: Add a user to a group on OneFS and in the local group-creation script.
docstring_tokens: Add a user to a group on OneFS and in the local group - creation script .
code: def add_user_to_group(self, user_name, group_name):
          """Add a user to a group on OneFS and in the local group-creation script."""
          try:
              LOGGER.info(
                  'Adding the %s user to the %s group on %s...',
                  user_name,
                  group_name,
                  self.onefs.address,
              )
              self.onefs.add_user_to_group(
                  user_name=user_name,
                  group_name=group_name,
                  zone=self.onefs_zone,
              )
          except isilon_hadoop_tools.onefs.APIError as exc:
              uid = self.onefs.uid_of_user(user_name=user_name, zone=self.onefs_zone)
              if exc.user_already_in_group_error(uid, group_name):
                  LOGGER.warning(exc.user_already_in_group_error_format.format(uid, group_name))
              else:
                  raise
          if self.script_path:
              self._create_script()
              LOGGER.info(
                  'Adding the %s user to the %s group in %s...',
                  user_name,
                  group_name,
                  self.script_path,
              )
              with open(self.script_path, 'a') as script_file:
                  script_file.write(
                      'usermod -a -G {group} {user}\n'.format(group=group_name, user=user_name),
                  )
code_tokens: def add_user_to_group ( self , user_name , group_name ) : try : LOGGER . info ( 'Adding the %s user to the %s group on %s...' , user_name , group_name , self . onefs . address , ) self . onefs . add_user_to_group ( user_name = user_name , group_name = group_name , zone = self . onefs_zone , ) except isilon_hadoop_tools . onefs . APIError as exc : uid = self . onefs . uid_of_user ( user_name = user_name , zone = self . onefs_zone ) if exc . user_already_in_group_error ( uid , group_name ) : LOGGER . warning ( exc . user_already_in_group_error_format . format ( uid , group_name ) ) else : raise if self . script_path : self . _create_script ( ) LOGGER . info ( 'Adding the %s user to the %s group in %s...' , user_name , group_name , self . script_path , ) with open ( self . script_path , 'a' ) as script_file : script_file . write ( 'usermod -a -G {group} {user}\n' . format ( group = group_name , user = user_name ) , )
short_docstring: Add a user to a group on OneFS and in the local group-creation script.
short_docstring_tokens: Add a user to a group on OneFS and in the local group - creation script .
comment: """Add a user to a group on OneFS and in the local group-creation script."""