register-public-ssh-key-content

Description

Registers the content of a public ssh key to a variable.

Either the 'path' or the 'key_content' argument must be provided

Variables

Name Type Default Description

register_name

string --

The name of the key to register the public key content under. Required

key_content

string --

The content of the ssh key.

path

string --

The (absolute) path to the public ssh key.

user

string --

The name of the user who owns the ssh key.

Code

doc:
  short_help: Registers the content of a public ssh key.
  help: |
    Registers the content of a public ssh key to a variable.

    Either the 'path' or the 'key_content' argument must be provided

args:
  path:
    doc:
      short_help: The (absolute) path to the public ssh key.
    type: string
    required: false
  key_content:
    doc:
      short_help: The content of the ssh key.
    required: false
    type: string
  user:
    doc:
      short_help: The name of the user who owns the ssh key.
    type: string
    required: false
  register_name:
    doc:
      short_help: The name of the key to register the public key content under.
    type: string
    required: true

frecklets:
- frecklet:
    name: register-public-ssh-key.at.yml
    type: ansible-tasklist
    resources:
      ansible-tasklist:
      - register-var.at.yml
      - internally-register-public-ssh-key.at.yml
      - register-public-ssh-key.at.yml
  vars:
    __path_to_key__: '{{:: path ::}}'
    __key_content__: '{{:: key_content ::}}'
    __become__: '{{:: user | false_if_empty ::}}'
    __become_user__: '{{:: user ::}}'
    __ssh_key_register_var__: '{{:: register_name ::}}'
frecklecute --community register-public-ssh-key-content --help

Usage: frecklecute register-public-ssh-key-content [OPTIONS]

  Registers the content of a public ssh key to a variable.

  Either the 'path' or the 'key_content' argument must be provided

Options:
  --register-name REGISTER_NAME  The name of the key to register the public
                                 key content under.  [required]
  --key-content KEY_CONTENT      The content of the ssh key.
  --path PATH                    The (absolute) path to the public ssh key.
  --user USER                    The name of the user who owns the ssh key.
  --help                         Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.register_public_ssh_key_content.RegisterPublicSshKeyContent
#


from dataclasses import dataclass
from pyckles import AutoPycklet
from typing import *    # noqa

@dataclass
class RegisterPublicSshKeyContent(AutoPycklet):
    """Registers the content of a public ssh key to a variable.

     Either the 'path' or the 'key_content' argument must be provided

       Args:
         key_content: The content of the ssh key.
         path: The (absolute) path to the public ssh key.
         register_name: The name of the key to register the public key content under.
         user: The name of the user who owns the ssh key.

    """

    FRECKLET_ID = "register-public-ssh-key-content"

    key_content: str = None
    path: str = None
    register_name: str = None
    user: str = None


    def __post_init__(self):
        super(RegisterPublicSshKeyContent, self).__init__(var_names=["key_content", "path", "register_name", "user"])


frecklet_class = RegisterPublicSshKeyContent
# -*- coding: utf-8 -*-


#
# module path: pycklets.register_public_ssh_key_content.RegisterPublicSshKeyContent
#


from pyckles import AutoPycklet

class RegisterPublicSshKeyContent(AutoPycklet):
    """Registers the content of a public ssh key to a variable.

     Either the 'path' or the 'key_content' argument must be provided

       Args:
         key_content: The content of the ssh key.
         path: The (absolute) path to the public ssh key.
         register_name: The name of the key to register the public key content under.
         user: The name of the user who owns the ssh key.

    """

    FRECKLET_ID = "register-public-ssh-key-content"

    def __init__(self, key_content=None, path=None, register_name=None, user=None):

        super(RegisterPublicSshKeyContent, self).__init__(var_names=["key_content", "path", "register_name", "user"])
        self._key_content = key_content
        self._path = path
        self._register_name = register_name
        self._user = user

    @property
    def key_content(self):
        return self._key_content

    @key_content.setter
    def key_content(self, key_content):
        self._key_content = key_content

    @property
    def path(self):
        return self._path

    @path.setter
    def path(self, path):
        self._path = path

    @property
    def register_name(self):
        return self._register_name

    @register_name.setter
    def register_name(self, register_name):
        self._register_name = register_name

    @property
    def user(self):
        return self._user

    @user.setter
    def user(self, user):
        self._user = user



frecklet_class = RegisterPublicSshKeyContent