From 05a1e169498522f26124c4133ef3ac45cfd8609a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Luka=C5=A1=C3=ADk?= Date: Tue, 10 Oct 2023 10:04:52 +0200 Subject: [PATCH] remove unused code --- ssg/ansible.py | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/ssg/ansible.py b/ssg/ansible.py index e937a07427f..1d57c409702 100644 --- a/ssg/ansible.py +++ b/ssg/ansible.py @@ -39,13 +39,6 @@ def add_minimum_version(ansible_src): return ansible_src.replace(" - hosts: all", pre_task, 1) -def add_play_name(ansible_src, profile): - old_play_start = r"^( *)- hosts: all" - new_play_start = ( - r"\1- name: Ansible Playbook for %s\n\1 hosts: all" % (profile)) - return re.sub(old_play_start, new_play_start, ansible_src, flags=re.M) - - def remove_too_many_blank_lines(ansible_src): """ Condenses three or more empty lines as two. @@ -58,34 +51,3 @@ def remove_trailing_whitespace(ansible_src): Removes trailing whitespace in an Ansible script """ return re.sub(r'[ \t]+$', '', ansible_src, 0, flags=re.M) - - -def strip_eof(ansible_src): - """ - Removes extra newlines at end of file - """ - return ansible_src.rstrip() + "\n" - - -def _strings_to_list(one_or_more_strings): - """ - Output a list, that either contains one string, or a list of strings. - In Python, strings can be cast to lists without error, but with unexpected result. - """ - if isinstance(one_or_more_strings, str): - return [one_or_more_strings] - else: - return list(one_or_more_strings) - - -def update_yaml_list_or_string(current_contents, new_contents): - result = [] - if current_contents: - result += _strings_to_list(current_contents) - if new_contents: - result += _strings_to_list(new_contents) - if not result: - result = "" - if len(result) == 1: - result = result[0] - return result