<commit_before>########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed 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.

__author__ = 'nirb'

import yaml
import novaclient.v1_1.client as nvclient
import neutronclient.v2_0.client as neclient
from path import path


def teardown(cloud_config_file_path,
             remove_server=True,
             remove_network=False,
             remove_security_groups=False,
             remove_keypairs=False):

    cloud_config = yaml.load(path(cloud_config_file_path).text())

    creds = get_client_creds(cloud_config)
    nova = nvclient.Client(**creds)
    neutron = neclient.Client(username=creds['username'],
                              password=creds['<PASSWORD>_key'],
                              tenant_name=creds['project_id'],
                              region_name=creds['region_name'],
                              auth_url=creds['auth_url'])
<commit_msg>CFY-3 add logging to cloud termination<commit_after>########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed 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.

__author__ = 'nirb'

import logging

import yaml
import novaclient.v1_1.client as nvclient
import neutronclient.v2_0.client as neclient
from path import path


logger = logging.getLogger('cloud-terminator')
logger.setLevel(logging.INFO)


def teardown(cloud_config_file_path,
             remove_server=True,
             remove_network=False,
             remove_security_groups=False,
             remove_keypairs=False):
    logger.info('Terminating cloud bootstrapped earlier using configuration'
                ' from {0}'.format(cloud_config_file_path))

    cloud_config = yaml.load(path(cloud_config_file_path).text())

    creds = get_client_creds(cloud_config)
    nova = nvclient.Client(**creds)
    neutron = neclient.Client(username=creds['username'],
                              password=<PASSWORD>['<PASSWORD>'],
                              tenant_name=creds['project_id'],
                              region_name=creds['region_name'],
                              auth_url=creds['auth_url'])

{'fraction_non_alphanumeric': 0.08717624763108023, 'fraction_numerical': 0.0082122552116235, 'mean_word_length': 2.963704630788486, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, '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': '4217684', 'n_tokens_mistral': 878, 'n_tokens_neox': 850, 'n_words': 262}