register-path-details

Example:

# Register details of '/home/freckles/.local/share/freckles/bin/freckles' into register variable 'freckles_bin'.
- register-path-details:
    path: /home/freckles/.local/share/freckles/bin/freckles
    register_var: freckles_bin

Description

If the path in question can not be read by the user who executes this frecklet, the 'become' argument needs to be set to 'true'.

Variables

Name Type Default Description

path

string --

The path to check. Required

register_var

string --

The name of the variable to register. Required

become

boolean False

Whether to use elevated privileges to check the path.

Examples

Example 1

Register details of '/home/freckles/.local/share/freckles/bin/freckles' into register variable 'freckles_bin'.

Code
- register-path-details:
    path: /home/freckles/.local/share/freckles/bin/freckles
    register_var: freckles_bin

Code

doc:
  short_help: Registers the details of a path (file/folder/link) into a specified
    register variable.
  help: |
    If the path in question can not be read by the user who executes this frecklet, the 'become' argument needs to be set to 'true'.
  examples:
  - title: Register details of '/home/freckles/.local/share/freckles/bin/freckles'
      into register variable 'freckles_bin'.
    vars:
      path: /home/freckles/.local/share/freckles/bin/freckles
      register_var: freckles_bin

args:
  path:
    doc:
      short_help: The path to check.
    type: string
    required: true
    cli:
      param_type: argument
  become:
    doc:
      short_help: Whether to use elevated privileges to check the path.
    type: boolean
    default: false
    required: false
    cli:
      param_decls:
      - --become
  register_var:
    doc:
      short_help: The name of the variable to register.
    type: string
    required: true

frecklets:
- frecklet:
    name: stat
    type: ansible-module
    properties:
      elevated: '{{:: become ::}}'
      idempotent: false
      internet: false
    desc:
      short: 'getting details for: {{:: path ::}}'
    register: '{{:: register_var ::}}'
  task:
    become: '{{:: become ::}}'
  vars:
    path: '{{:: path ::}}'
frecklecute register-path-details --help

Usage: frecklecute register-path-details [OPTIONS] PATH

  If the path in question can not be read by the user who executes this
  frecklet, the 'become' argument needs to be set to 'true'.

Options:
  --register-var REGISTER_VAR  The name of the variable to register.
                               [required]
  --become                     Whether to use elevated privileges to check the
                               path.
  --help                       Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.register_path_details.RegisterPathDetails
#


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

@dataclass
class RegisterPathDetails(AutoPycklet):
    """If the path in question can not be read by the user who executes this frecklet, the 'become' argument needs to be set to 'true'.

       Args:
         become: Whether to use elevated privileges to check the path.
         path: The path to check.
         register_var: The name of the variable to register.

    """

    FRECKLET_ID = "register-path-details"

    become: bool = None
    path: str = None
    register_var: str = None


    def __post_init__(self):
        super(RegisterPathDetails, self).__init__(var_names=["become", "path", "register_var"])


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


#
# module path: pycklets.register_path_details.RegisterPathDetails
#


from pyckles import AutoPycklet

class RegisterPathDetails(AutoPycklet):
    """If the path in question can not be read by the user who executes this frecklet, the 'become' argument needs to be set to 'true'.

       Args:
         become: Whether to use elevated privileges to check the path.
         path: The path to check.
         register_var: The name of the variable to register.

    """

    FRECKLET_ID = "register-path-details"

    def __init__(self, become=None, path=None, register_var=None):

        super(RegisterPathDetails, self).__init__(var_names=["become", "path", "register_var"])
        self._become = become
        self._path = path
        self._register_var = register_var

    @property
    def become(self):
        return self._become

    @become.setter
    def become(self, become):
        self._become = become

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

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

    @property
    def register_var(self):
        return self._register_var

    @register_var.setter
    def register_var(self, register_var):
        self._register_var = register_var



frecklet_class = RegisterPathDetails