Skip to content

Commit

Permalink
Merge pull request #10 from itoffshore/testing
Browse files Browse the repository at this point in the history
improve examples / improve delete menu
  • Loading branch information
itoffshore committed Oct 15, 2023
2 parents a1a1dc5 + 7d5319f commit 11784e5
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 61 deletions.
Binary file removed dist/distrobuilder_menu-0.1.5.tar.gz
Binary file not shown.
Binary file not shown.
Binary file added dist/distrobuilder_menu-0.1.6.tar.gz
Binary file not shown.
12 changes: 10 additions & 2 deletions examples/cloudinit/user-data/alpine-abuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
version: v1
bootcmd:
- sed -i '/cloud-init/d' /etc/apk/world
- apk upgrade
- sed -i '/openssh/d' /etc/apk/world
- sed -i '/py3-netifaces/d' /etc/apk/world
- sed -i '/py3-pyserial/d' /etc/apk/world
packages:
- alpine-sdk
- openssh-client
- less
- ncdu
- vim
packages_update: true
packages_upgrade: false
packages_upgrade: true
users:
- default
- name: alpine
Expand Down
23 changes: 10 additions & 13 deletions examples/templates/custom/alpine-abuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,17 @@ files:
version: v1
bootcmd:
- sed -i '/cloud-init/d' /etc/apk/world
- apk upgrade
- sed -i '/openssh/d' /etc/apk/world
- sed -i '/py3-netifaces/d' /etc/apk/world
- sed -i '/py3-pyserial/d' /etc/apk/world
packages:
- alpine-sdk
- openssh-client
- less
- ncdu
- vim
packages_update: true
packages_upgrade: false
packages_upgrade: true
users:
- default
- name: alpine
Expand Down Expand Up @@ -398,23 +406,12 @@ packages:
- vm

- packages:
- htop
- curl
- nano
- nano-syntax
- htop
- nftables
- apk-cron
- shadow
- tzdata
- msmtp
action: install

- packages:
- alpine-sdk
- less
- ncdu
- vim
action: install

actions:
Expand Down
2 changes: 0 additions & 2 deletions examples/templates/custom/alpine-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,6 @@ packages:
- vm

- packages:
- htop
- curl
- nano
- nano-syntax
- htop
Expand Down
12 changes: 6 additions & 6 deletions examples/templates/custom/ubuntu-gitlab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -490,27 +490,27 @@ files:
- default

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-base/home
source: ~/distrobuilder/files/ubuntu-base/home
path: /home/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-base/etc
source: ~/distrobuilder/files/ubuntu-base/etc
path: /etc/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-base/root
source: ~/distrobuilder/files/ubuntu-base/root
path: /root/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-gitlab/usr
source: ~/distrobuilder/files/ubuntu-gitlab/usr
path: /usr/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-gitlab/etc
source: ~/distrobuilder/files/ubuntu-gitlab/etc
path: /etc/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-gitlab/root
source: ~/distrobuilder/files/ubuntu-gitlab/root
path: /root/

packages:
Expand Down
14 changes: 7 additions & 7 deletions examples/templates/custom/ubuntu-podman.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -486,31 +486,31 @@ files:
- default

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-base/home
source: ~/distrobuilder/files/ubuntu-base/home
path: /home/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-base/etc
source: ~/distrobuilder/files/ubuntu-base/etc
path: /etc/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-base/root
source: ~/distrobuilder/files/ubuntu-base/root
path: /root/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-podman/home
source: ~/distrobuilder/files/ubuntu-podman/home
path: /home/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-podman/etc
source: ~/distrobuilder/files/ubuntu-podman/etc
path: /etc/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-podman/usr
source: ~/distrobuilder/files/ubuntu-podman/usr
path: /usr/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-podman/root
source: ~/distrobuilder/files/ubuntu-podman/root
path: /root/

packages:
Expand Down
20 changes: 4 additions & 16 deletions examples/templates/overrides/alpine-abuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,21 @@
files:

- generator: copy
source: /home/stuart/devops/distrobuilder/files/alpine-abuild/home
source: ~/distrobuilder/files/alpine-abuild/home
mode: 644
path: /home/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/alpine-abuild/etc
source: ~/distrobuilder/files/alpine-abuild/etc
mode: 644
path: /etc/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/alpine-abuild/root
source: ~/distrobuilder/files/alpine-abuild/root
mode: 644
path: /root/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/alpine-abuild/cloudinit-per-once
source: ~/distrobuilder/files/alpine-abuild/cloudinit-per-once
mode: 700
path: /var/lib/cloud/scripts/per-once/

packages:
manager: apk
update: true
cleanup: true
sets:
- packages:
- alpine-sdk
- less
- ncdu
- vim
action: install
2 changes: 0 additions & 2 deletions examples/templates/overrides/alpine-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ packages:
sets:
- packages:
- htop
- curl
- nano
- nano-syntax
- htop
- nftables
- apk-cron
- shadow
Expand Down
6 changes: 3 additions & 3 deletions examples/templates/overrides/ubuntu-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
files:

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-base/etc
source: ~/distrobuilder/files/ubuntu-base/etc
path: /etc/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-base/home
source: ~/distrobuilder/files/ubuntu-base/home
path: /home/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-base/root
source: ~/distrobuilder/files/ubuntu-base/root
path: /root/

packages:
Expand Down
6 changes: 3 additions & 3 deletions examples/templates/overrides/ubuntu-gitlab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
files:

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-gitlab/usr
source: ~/distrobuilder/files/ubuntu-gitlab/usr
path: /usr/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-gitlab/etc
source: ~/distrobuilder/files/ubuntu-gitlab/etc
path: /etc/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-gitlab/root
source: ~/distrobuilder/files/ubuntu-gitlab/root
path: /root/

packages:
Expand Down
8 changes: 4 additions & 4 deletions examples/templates/overrides/ubuntu-podman.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
files:

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-podman/home
source: ~/distrobuilder/files/ubuntu-podman/home
path: /home/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-podman/etc
source: ~/distrobuilder/files/ubuntu-podman/etc
path: /etc/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-podman/usr
source: ~/distrobuilder/files/ubuntu-podman/usr
path: /usr/

- generator: copy
source: /home/stuart/devops/distrobuilder/files/ubuntu-podman/root
source: ~/distrobuilder/files/ubuntu-podman/root
path: /root/
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build-backend = "hatchling.build"

[project]
name = "distrobuilder_menu"
version = "0.1.5"
version = "0.1.6"
authors = [
{ name="Stuart Cardall", email="developer@it-offshore.co.uk" },
]
Expand Down
6 changes: 4 additions & 2 deletions src/distrobuilder_menu/menus/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,16 @@ def menu_delete():
# Menu can display 'keys' (filename) or 'value' (file path) or 'both'
menu = Menu(menu_context['title'], menu_context['question'], template_files, 'keys')
# get_choice() returns a dict with 2 x keys ('key' / 'value')
file_path = menu.get_choice()['value']
choice = menu.get_choice()
file_path = choice['value']
file_name = choice['key']

# return to main event loop
if file_path == 'user_quit':
return

# confirm delete
choice = utils.get_input(f"Delete config: {file_path} [N/y]: ? ",
choice = utils.get_input(f"Delete config: {file_name} [N/y]: ? ",
accept_empty=True
)
if choice.startswith('y') or choice.startswith('Y'):
Expand Down

0 comments on commit 11784e5

Please sign in to comment.