Chef-like functionality for Fabric

Related tags

DevOps Toolscuisine
Overview
           /      /
 ___         ___    ___  ___
|    |   )| |___ | |   )|___)
|__  |__/ |  __/ | |  / |__

-- Chef-like functionality for Fabric

About

Fabric is an incredible tool to automate administration of remote machines. As Fabric's functions are rather low-level, you'll probably quickly see a need for more high-level functions such as add/remove users and groups, install/upgrade packages, etc.

Cuisine is a small set of functions that sit on top of Fabric, to abstract common administration operations such as file/dir operations, user/group creation, package install/upgrade, making it easier to write portable administration and deployment scripts.

Cuisine's features are:

  • Small, easy to read, a single file API: <object>_<operation>() e.g. dir_exists(location) tells if there is a remote directory at the given location.
  • Covers file/dir operations, user/group operations, package operations
  • Text processing and template functions
  • All functions are lazy: they will actually only do things when the change is required.

Installation

Cuisine is on PyPI so you can either use easy_install -U cuisine or pip install cuisine to install it. Otherwise, you can download the source from GitHub and run python setup.py install.

Cuisine requires Python 2.7, and has not been tested with Python 3 yet.

How to get started

Open up a python shell and type:

import cuisine

Cuisine is designed to be a flat-file module, where all functions are prefixed by the type of functionality they offer (e.g., file for file operations, user for user operations). The available groups are:

text_*
Text-processing functions
file_*
File operations
dir_*
Directory operations
package_*
Package management operations
command_*
Shell commands availability
user_*
User creation commands
group*
Group creation commands
mode_*
Configures cuisine's behaviour within the current session.
select_*
Selects a specific option, such as package back-end (apt, yum, zypper, or pacman)

If you're using an interactive Python shell such as IPython you can easily browse the available functions by using tab-completion.

In [2]: cuisine.file_
cuisine.file_append       cuisine.file_is_file      cuisine.file_unlink
cuisine.file_attribs      cuisine.file_is_link      cuisine.file_update
cuisine.file_attribs_get  cuisine.file_link         cuisine.file_upload
cuisine.file_ensure       cuisine.file_local_read   cuisine.file_write
cuisine.file_exists       cuisine.file_read
cuisine.file_is_dir       cuisine.file_sha256

As the functions are prefixed by they type of functionality, it is very easy to get started using an interactive shell.

If you would like to use cuisine without using a fabfile, you can call the mode_local() function.

import cuisine
cuisine.mode_local()
print cuisine.run("echo Hello")

alternatively, you can also directly connect to a server

import cuisine
cuisine.connect("my.server.com")
print cuisine.run("echo Hello")

If you want to use cuisine within a fabfile, simply create a fabfile with the following content:

from cuisine import *

def setup():
    group_ensure("remote_admin")
    user_ensure("admin")
    group_user_ensure("remote_admin", "admin")

Troubleshooting

If you are encoutering problems, please check the following:

  • The [email protected] is running an SH-compatible shell (sh, dash, bash, zsh should work)
  • The system has openssl base64, md5sum and sha1sum commands in addition to the basic UNIX ones.

If you still have a problem, simply file a bug report here https://github.com/sebastien/cuisine/issues

Right now, cuisine is tested on Ubuntu. Some contributors use it on RHEL and CentOS. If you use on a different system, let us know if it works!

Contributing specific implementations

Cuisine was originally developed as a Debian/Ubuntu-centric tool, but can easily be adapted to other distributions or Unix flavor, the only caveat being that the shell is expected to be bash-compatible.

If you want to implement a specific variant of some functions for a specific platform, you should do the following:

  1. Open the cuisine.py source and look for the definition of the function that you would like to specialize.
  2. If the function is decorated by '@dispatch', it means it already supports specific back-ends (see package_* functions), and you can proceed to the next step. Otherwise, you can either file a ticket on Github or read the source and mimic what we've done for package_*
  3. Create a specific version of the decorated function by creating a new function with the same name, suffixed by your specific backend name. For instance, if you'd like to create a yum backend to package_ensure, you would need to create a function package_ensure_yum with the same arguments as package_ensure
  4. Once you've created your specific functions, make sure that you have a select_* matching your function group. For the package_* functions, this would be select_package.
  5. Look for the supported variable in the select_* and add your backend suffix to it (in our example, this would be yum)

To use a specific backend implementation of a set of features, use the select_* functions.

# To use the 'apt' backend
cuisine.select_package("apt")
# To see the available backends
print cuisine.select_package()

Modules

Cuisine-PostgreSQL http://pypi.python.org/pypi/cuisine-postgresql/

More?

If you want more information, you can:

Owner
Sébastien Pierre
Sébastien Pierre
Azure plugins for Feast (FEAture STore)

Feast on Azure This project provides resources to enable running a feast feature store on Azure. Feast Azure Provider The Feast Azure provider acts li

Microsoft Azure 70 Dec 31, 2022
Phonebook application to manage phone numbers

PhoneBook Phonebook application to manage phone numbers. How to Use run main.py python file. python3 main.py Links Download Source Code: Click Here M

Mohammad Dori 3 Jul 15, 2022
A tool to clone efficiently all the repos in an organization

cloner A tool to clone efficiently all the repos in an organization Installation MacOS (not yet tested) python3 -m venv .venv pip3 install virtualenv

Ramon 6 Apr 15, 2022
Oncall is a calendar tool designed for scheduling and managing on-call shifts. It can be used as source of dynamic ownership info for paging systems like http://iris.claims.

Oncall See admin docs for information on how to run and manage Oncall. Development setup Prerequisites Debian/Ubuntu - sudo apt-get install libsasl2-d

LinkedIn 928 Dec 22, 2022
MLops tools review for execution on multiple cluster types: slurm, kubernetes, dask...

MLops tools review focused on execution using multiple cluster types: slurm, kubernetes, dask...

4 Nov 30, 2022
A Habitica Integration with Github Workflows.

Habitica-Workflow A Habitica Integration with Github Workflows. How To Use? Fork (and Star) this repository. Set environment variable in Settings - S

Priate 2 Dec 20, 2021
This repository contains useful docker-swarm-tools.

docker-swarm-tools This repository contains useful docker-swarm-tools. swarm-guardian This Docker image is intended to be used in a multihost docker e

NeuroForge GmbH & Co. KG 4 Jan 12, 2022
Wiremind Kubernetes helper

Wiremind Kubernetes helper This Python library is a high-level set of Kubernetes Helpers allowing either to manage individual standard Kubernetes cont

Wiremind 3 Oct 09, 2021
HXVM - Check Host compatibility with the Virtual Machines

HXVM - Check Host compatibility with the Virtual Machines. Features | Installation | Usage Features Takes input from user to compare how many VMs they

Aman Srivastava 4 Oct 15, 2022
a CLI that provides a generic automation layer for assessing the security of ML models

Counterfit About | Getting Started | Learn More | Acknowledgments | Contributing | Trademarks | Contact Us -------------------------------------------

Microsoft Azure 575 Jan 02, 2023
A collection of beginner-friendly DevOps content

mansion Mansion is just a testing repo for learners to commit into open source project. These are the steps you need to learn: Please do not edit thes

Bryan Lim 62 Nov 30, 2022
🎡 Build Python wheels for all the platforms on CI with minimal configuration.

cibuildwheel Documentation Python wheels are great. Building them across Mac, Linux, Windows, on multiple versions of Python, is not. cibuildwheel is

Python Packaging Authority 1.3k Jan 02, 2023
Containerize a python web application

containerize a python web application introduction this document is part of GDSC at the university of bahrain you don't need to follow along, fell fre

abdullah mosibah 1 Oct 19, 2021
Universal Command Line Interface for Amazon Web Services

aws-cli This package provides a unified command line interface to Amazon Web Services. Jump to: Getting Started Getting Help More Resources Getting St

Amazon Web Services 13.3k Jan 01, 2023
A cron monitoring tool written in Python & Django

Healthchecks Healthchecks is a cron job monitoring service. It listens for HTTP requests and email messages ("pings") from your cron jobs and schedule

Healthchecks 5.8k Jan 02, 2023
Google Kubernetes Engine (GKE) with a Snyk Kubernetes controller installed/configured for Snyk App

Google Kubernetes Engine (GKE) with a Snyk Kubernetes controller installed/configured for Snyk App This example provisions a Google Kubernetes Engine

Pas Apicella 2 Feb 09, 2022
Automate SSH in python easily!

RedExpect RedExpect makes automating remote machines over SSH very easy to do and is very fast in doing exactly what you ask of it. Based on ssh2-pyth

Red_M 19 Dec 17, 2022
sysctl/sysfs settings on a fly for Kubernetes Cluster. No restarts are required for clusters and nodes.

SysBindings Daemon Little toolkit for control the sysctl/sysfs bindings on Kubernetes Cluster on the fly and without unnecessary restarts of cluster o

Wallarm 19 May 06, 2022
Asynchronous parallel SSH client library.

parallel-ssh Asynchronous parallel SSH client library. Run SSH commands over many - hundreds/hundreds of thousands - number of servers asynchronously

1.1k Dec 31, 2022
Knock your images before these make you painful.

image-knocker Knock your images before these make you painful. Background One day, I had run my deep learning model training program and got off work

Yonghye Kwon 9 Jul 25, 2022