Skip to content

Commit

Permalink
Merge branch 'release/1.18.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
lueschem committed Apr 19, 2024
2 parents 42a9aa4 + 40d0d32 commit e0c92f5
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 12 deletions.
8 changes: 8 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
edi (1.18.0) mantic; urgency=medium

[ Matthias Luescher ]
* Be careful about removing stuff from the lintian folder.
* Implemented --start-at-task option. Closes #86.

-- Matthias Lüscher (Launchpad) <m.luescher@datacomm.ch> Fri, 19 Apr 2024 14:43:10 +0200

edi (1.17.0) mantic; urgency=medium

[ Matthias Luescher ]
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
# built documents.
#
# The short X.Y version.
version = '1.17.0'
release = '1.17.0'
version = '1.18.0'
release = '1.18.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
5 changes: 4 additions & 1 deletion edi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def _setup_command_line_interface():
help="modify log level (default is WARNING)")
parser.add_argument('-d', '--debug', action="store_true",
help="switch command processing into interactive debug mode (useful for playbook debugging)")
parser.add_argument('-s', '--start-at-task', type=str, default="",
help="start the Ansible playbook processing at a given task (useful for playbook debugging)")

subparsers = parser.add_subparsers(title='commands',
dest="command_name")
Expand All @@ -77,7 +79,8 @@ def main():

command_name = "{0}.{1}".format(EdiCommand._get_command_name(),
cli_args.command_name)
with command_context({'edi_debug_mode': cli_args.debug}):
with command_context({'edi_debug_mode': cli_args.debug,
'edi_start_at_task': cli_args.start_at_task}):
get_command(command_name)().run_cli(cli_args)
except FatalError as fatal_error:
print_error_and_exit(fatal_error.message)
Expand Down
5 changes: 5 additions & 0 deletions edi/lib/configurationparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class ConfigurationParser:
'edi_create_distributable_image': False,
'edi_configure_remote_target': False,
'edi_debug_mode': False,
'edi_start_at_task': "",
}

@staticmethod
Expand All @@ -113,6 +114,10 @@ def configure_remote_target():
def debug_mode():
return ConfigurationParser.command_context.get('edi_debug_mode')

@staticmethod
def get_start_task():
return ConfigurationParser.command_context.get('edi_start_at_task')

def get_context_suffix(self):
if self.create_distributable_image():
return '_di'
Expand Down
17 changes: 14 additions & 3 deletions edi/lib/playbookrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
import tempfile
import yaml
from codecs import open
from edi.lib.helpers import chown_to_user
from edi.lib.helpers import chown_to_user, FatalError
from edi.lib.helpers import print_error, get_user, get_workdir
from edi.lib.shellhelpers import run, require
from edi.lib.sharedfoldercoordinator import SharedFolderCoordinator
from edi.lib.configurationparser import remove_passwords


class PlaybookRunner():
class PlaybookRunner:

def __init__(self, config, target, connection):
self.config = config
Expand All @@ -49,7 +49,13 @@ def run_all(self):
chown_to_user(tempdir)
inventory = self._write_inventory_file(tempdir)

for name, path, extra_vars, in self._get_playbooks():
collected_playbooks = self._get_playbooks()

if len(collected_playbooks) > 1 and self.config.get_start_task():
raise FatalError("The -s/--start-at-task feature is currently only available for configurations "
"that contain just one playbook!")

for name, path, extra_vars, in collected_playbooks:
logging.info(("Running playbook {} located in "
"{} with extra vars:\n{}"
).format(name, path,
Expand Down Expand Up @@ -100,6 +106,11 @@ def _run_playbook(self, playbook, inventory, extra_vars, ansible_user):
if snap_path not in os.environ['PATH']:
cmd.extend(["env", "PATH={}:{}".format(os.environ['PATH'], snap_path)])
cmd.append("ansible-playbook")

start_task = self.config.get_start_task()
if start_task:
cmd.extend(["--start-at-task", start_task])

cmd.extend(["--connection", self.connection])
cmd.extend(["--inventory", inventory])
cmd.extend(["--extra-vars", "@{}".format(extra_vars)])
Expand Down
2 changes: 1 addition & 1 deletion edi/lib/versionhelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

# The do_release script will update this version!
# During launchpad debuild neither the git version nor the package version is available.
edi_fallback_version = '1.17.0'
edi_fallback_version = '1.18.0'


def get_edi_version():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DPKG_CONTROL_FILE=$1
find /usr/share/doc -depth -type f ! -name copyright|xargs rm || true
find /usr/share/doc -empty|xargs rmdir || true
rm -rf /usr/share/man /usr/share/groff /usr/share/info
rm -rf /usr/share/lintian /usr/share/linda /var/cache/man
rm -rf /usr/share/lintian/overrides /usr/share/linda /var/cache/man

cat << EOF > ${DPKG_CONTROL_FILE}
# save disk space by excluding documentation
Expand All @@ -18,7 +18,7 @@ path-include /usr/share/doc/*/copyright
path-exclude /usr/share/man/*
path-exclude /usr/share/groff/*
path-exclude /usr/share/info/*
path-exclude /usr/share/lintian/*
path-exclude /usr/share/lintian/overrides/*
path-exclude /usr/share/linda/*
EOF

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DPKG_CONTROL_FILE=$1
find /usr/share/doc -depth -type f ! -name copyright ! -name changelog.Debian.gz ! -name changelog.gz |xargs rm || true
find /usr/share/doc -empty|xargs rmdir || true
rm -rf /usr/share/man /usr/share/groff /usr/share/info
rm -rf /usr/share/lintian /usr/share/linda /var/cache/man
rm -rf /usr/share/lintian/overrides /usr/share/linda /var/cache/man

cat << EOF > ${DPKG_CONTROL_FILE}
# save disk space by excluding documentation
Expand All @@ -21,7 +21,7 @@ path-include /usr/share/doc/*/changelog.gz
path-exclude /usr/share/man/*
path-exclude /usr/share/groff/*
path-exclude /usr/share/info/*
path-exclude /usr/share/lintian/*
path-exclude /usr/share/lintian/overrides/*
path-exclude /usr/share/linda/*
EOF

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
setup(
name='edi',

version='1.17.0',
version='1.18.0',

description='Embedded Development Infrastructure - edi',
long_description=long_description,
Expand Down

0 comments on commit e0c92f5

Please sign in to comment.