Skip to content

Enable scaffolding of cliconf and terminal plugin files#16

Open
GomathiselviS wants to merge 2 commits into
ansible-network:mainfrom
GomathiselviS:scaffold_plugin
Open

Enable scaffolding of cliconf and terminal plugin files#16
GomathiselviS wants to merge 2 commits into
ansible-network:mainfrom
GomathiselviS:scaffold_plugin

Conversation

@GomathiselviS
Copy link
Copy Markdown
Member

Signed-off-by: GomathiselviS gomathiselvi@gmail.com

Fixes #11

This PR enables the scaffolding of cliconf and terminal plugin files via cli_rm_builder.

Signed-off-by: GomathiselviS <gomathiselvi@gmail.com>
@GomathiselviS
Copy link
Copy Markdown
Member Author

cc @NilashishC

@@ -0,0 +1,206 @@
# -*- coding: utf-8 -*-
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of the code in this template is platform specific. IMO, we should only be adding methods that are marked as "abstractmethods" in CliconfBase and possibly keep a docstring and an empty definition to allow end users to understand what that method is meant to be and how they should implement it.


def on_open_shell(self):
try:
for cmd in (b"terminal length 0", b"terminal width 512"):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The length and width values are not same across all platforms. Maybe we can specify what this method does in the method docstring and let the collection maintainers add the correct values.

@GomathiselviS GomathiselviS requested a review from NilashishC June 15, 2021 15:33
def __init__(self, *args, **kwargs):
super(Cliconf, self).__init__(*args, **kwargs)

@enable_mode
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The enable privilege escalation is not valid across all platforms. Maybe we can skip this?

import time
import re

from ansible.errors import AnsibleConnectionFailure
Copy link
Copy Markdown
Member

@NilashishC NilashishC Jun 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CliconfBase has multiple abstractmethods defined. An subclass needs to implement all that else the cliconf object is not created. Can we add stubs for all those methods here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] Scaffold cliconf and terminal plugins

2 participants