<commit_before>#!/usr/bin/env python
"""
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.

"""

__all__ = ["has_atlas_in_cluster", "setup_atlas_hook", "setup_atlas_jar_symlinks"]

# Python Imports
import os

# Local Imports
from resource_management.libraries.resources.properties_file import PropertiesFile
from resource_management.libraries.functions.format import format
from resource_management.libraries.functions.default import default
from resource_management.core.resources.system import Link
from resource_management.core.logger import Logger

'''
Only this subset of Atlas application.properties should be written out to each service that has an Atlas hook,
E.g., Hive, Storm, Sqoop, Falcon.
The reason for this is that we don't want configs to get out-of-sync between each of these services.
Assume Atlas application.properties contains props

private_prop_a
private_prop_b
private_prop_c
shared_atlas_hook_prop_d
shared_atlas_hook_prop_e

Then only shared_atlas_hook_prop_d and shared_atlas_hook_prop_e should be merged with the properties specific to
Hive, Storm, Sqoop, and Falcon.
E.g.,
Hive has,
specific_hive_atlas_hook_prop_f
specific_hive_atlas_hook_prop_g

So the atlas-application.properties.xml file that we write for Hive should contain,
shared_atlas_hook_prop_d
shared_atlas_hook_prop_e
specific_hive_atlas_hook_prop_f
specific_hive_atlas_hook_prop_g

Now, if the user wants to make a global change for Atlas hooks, they can change shared_atlas_hook_prop_d or shared_atlas_hook_prop_e
in a single place (under the Atlas Configs page).
If they want to overwrite shared_atlas_hook_prop_d just for Hive, they can add it to hive-atlas-application.properties
'''

SHARED_ATLAS_HOOK_CONFIGS = set(
  [
  "atlas.kafka.zookeeper.connect",
  "atlas.kafka.bootstrap.servers",
  "atlas.kafka.zookeeper.session.timeout.ms",
  "atlas.kafka.zookeeper.connection.timeout.ms",
  "atlas.kafka.zookeeper.sync.time.ms",
  "atlas.kafka.hook.group.id",
  "atlas.notification.create.topics",
  "atlas.notification.replicas",
  "atlas.notification.topics",
  "atlas.notification.kafka.service.principal",
  "atlas.notification.kafka.keytab.location",
  "atlas.cluster.name",

  # Security properties
  "atlas.kafka.sasl.kerberos.service.name",
  "atlas.kafka.security.protocol",
  "atlas.jaas.KafkaClient.loginModuleName",
  "atlas.jaas.KafkaClient.loginModuleControlFlag",
  "atlas.jaas.KafkaClient.option.useKeyTab",
  "atlas.jaas.KafkaClient.option.storeKey",
  "atlas.jaas.KafkaClient.option.serviceName"]<commit_msg>AMBARI-17803. Add atlas.authentication.method.kerberos property to conf/atlas-application.properties. (ajit)<commit_after>#!/usr/bin/env python
"""
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.

"""

__all__ = ["has_atlas_in_cluster", "setup_atlas_hook", "setup_atlas_jar_symlinks"]

# Python Imports
import os

# Local Imports
from resource_management.libraries.resources.properties_file import PropertiesFile
from resource_management.libraries.functions.format import format
from resource_management.libraries.functions.default import default
from resource_management.core.resources.system import Link
from resource_management.core.logger import Logger

'''
Only this subset of Atlas application.properties should be written out to each service that has an Atlas hook,
E.g., Hive, Storm, Sqoop, Falcon.
The reason for this is that we don't want configs to get out-of-sync between each of these services.
Assume Atlas application.properties contains props

private_prop_a
private_prop_b
private_prop_c
shared_atlas_hook_prop_d
shared_atlas_hook_prop_e

Then only shared_atlas_hook_prop_d and shared_atlas_hook_prop_e should be merged with the properties specific to
Hive, Storm, Sqoop, and Falcon.
E.g.,
Hive has,
specific_hive_atlas_hook_prop_f
specific_hive_atlas_hook_prop_g

So the atlas-application.properties.xml file that we write for Hive should contain,
shared_atlas_hook_prop_d
shared_atlas_hook_prop_e
specific_hive_atlas_hook_prop_f
specific_hive_atlas_hook_prop_g

Now, if the user wants to make a global change for Atlas hooks, they can change shared_atlas_hook_prop_d or shared_atlas_hook_prop_e
in a single place (under the Atlas Configs page).
If they want to overwrite shared_atlas_hook_prop_d just for Hive, they can add it to hive-atlas-application.properties
'''

SHARED_ATLAS_HOOK_CONFIGS = set(
  [
  "atlas.kafka.zookeeper.connect",
  "atlas.kafka.bootstrap.servers",
  "atlas.kafka.zookeeper.session.timeout.ms",
  "atlas.kafka.zookeeper.connection.timeout.ms",
  "atlas.kafka.zookeeper.sync.time.ms",
  "atlas.kafka.hook.group.id",
  "atlas.notification.create.topics",
  "atlas.notification.replicas",
  "atlas.notification.topics",
  "atlas.notification.kafka.service.principal",
  "atlas.notification.kafka.keytab.location",
  "atlas.cluster.name",

  # Security properties
  "atlas.authentication.method.kerberos",
  "atlas.kafka.sasl.kerberos.service.name",
  "atlas.kafka.security.protocol",
  "atlas.jaas.KafkaClient.loginModuleName",
  "atlas.jaas.KafkaClient.loginModuleControlFlag",
  "atlas.jaas.KafkaClient.option.useKeyTab",
  "atlas.jaas.KafkaClient.option.storeKey",
  "atlas.jaas.KafkaClient.option.serviceName"]
{'fraction_non_alphanumeric': 0.07507962991051115, 'fraction_numerical': 0.00197178826027605, 'mean_word_length': 5.620481927710843, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7492080', 'n_tokens_mistral': 2089, 'n_tokens_neox': 2047, 'n_words': 604}