<commit_before>#   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.

import logging

from osc_lib.i18n import _

from tripleoclient import command
from tripleoclient.workflows import deployment
from tripleoclient import utils


class OvercloudCredentials(command.Command):
    """Create the overcloudrc files"""

    log = logging.getLogger(__name__ + ".OvercloudCredentials")

    def get_parser(self, prog_name):
        parser = super(OvercloudCredentials, self).get_parser(prog_name)
        parser.add_argument(
                'stack',
                help=_("The name of the stack you want to "
                       "create rc files for."))
        parser.add_argument(
            '--directory',
            default=".",
            nargs='?',
            help=_("The directory to create the rc files. "
                   "Defaults to the current directory."))
        parser.add_argument(
            '--working-dir',
            action='store',
            help=_('The working directory that contains the input, output, '
                   'and generated files for the deployment.\n'
                   'Defaults to "$HOME/overcloud-deploy/<stack>"')
        )
        return parser

    def take_action(self, parsed_args):
        self.log.debug("take_action(%s)" % parsed_args)
        rc_params = utils.get_rc_params(
            parsed_args.working_dir)
        endpoint = utils.get_overcloud_endpoint(parsed_args.working_dir)
        admin_vip = utils.get_stack_saved_output_item(
            'KeystoneAdminVip', parsed_args.working_dir)
        deployment.create_overcloudrc(
            parsed_args.stack, endpoint, admin_vip, rc_params,
            output_dir=parsed_args.directory)<commit_msg>Default working_dir for overcloud credential command<commit_after>#   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.

import logging

from osc_lib.i18n import _

from tripleoclient import command
from tripleoclient.workflows import deployment
from tripleoclient import utils


class OvercloudCredentials(command.Command):
    """Create the overcloudrc files"""

    log = logging.getLogger(__name__ + ".OvercloudCredentials")

    def get_parser(self, prog_name):
        parser = super(OvercloudCredentials, self).get_parser(prog_name)
        parser.add_argument(
                'stack',
                help=_("The name of the stack you want to "
                       "create rc files for."))
        parser.add_argument(
            '--directory',
            default=".",
            nargs='?',
            help=_("The directory to create the rc files. "
                   "Defaults to the current directory."))
        parser.add_argument(
            '--working-dir',
            action='store',
            help=_('The working directory that contains the input, output, '
                   'and generated files for the deployment.\n'
                   'Defaults to "$HOME/overcloud-deploy/<stack>"')
        )
        return parser

    def take_action(self, parsed_args):
        self.log.debug("take_action(%s)" % parsed_args)
        if not parsed_args.working_dir:
            working_dir = utils.get_default_working_dir(parsed_args.stack)
        else:
            working_dir = parsed_args.working_dir
        rc_params = utils.get_rc_params(
            working_dir)
        endpoint = utils.get_overcloud_endpoint(working_dir)
        admin_vip = utils.get_stack_saved_output_item(
            'KeystoneAdminVip', working_dir)
        deployment.create_overcloudrc(
            parsed_args.stack, endpoint, admin_vip, rc_params,
            output_dir=parsed_args.directory)
{'fraction_non_alphanumeric': 0.08178679326715581, 'fraction_numerical': 0.002589555459646094, 'mean_word_length': 2.5247148288973382, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2222705', 'n_tokens_mistral': 1233, 'n_tokens_neox': 1229, 'n_words': 378}