Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confirm delete operations #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions proteuscmd/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,16 @@ def dns_set(proteus, view, domain, target):

@dns.command(name='delete')
@click.option('--view', **__view_args)
@click.option('--force/--no-force', default=False, type=bool,
help='Force will skip any additional confirmation.')
@click.argument('domain')
@with_proteus
def dns_delete(proteus, view, domain):
def dns_delete(proteus, view, force, domain):
'''Delete DNS record in Proteus
'''
if not force:
click.confirm(f'Do you really want do delete {domain}?', abort=True)

views = proteus.get_requested_views(view)
for name, view in views:
proteus.delete_record(view, domain)
Expand Down Expand Up @@ -154,11 +159,16 @@ def ip_set(proteus, name, admin_email, admin_name, admin_phone, comment, state,


@ip.command(name='delete')
@click.option('--force/--no-force', default=False, type=bool,
help='Force will skip any additional confirmation.')
@click.argument('ip', type=IPV4_TYPE)
@with_proteus
def ip_delete(proteus, ip):
def ip_delete(proteus, force, ip):
'''Delete assigned IPv4 address
'''
if not force:
click.confirm(f'Do you really want do delete {ip}?', abort=True)

# get notwork information
data = proteus.get_entities_by_name('default', 0, 'Configuration')
conf_id = data[0]['id']
Expand Down
Loading