Error: Failed to install cookbooks from lockfile

When the CI/CD pipeline loads dependency cookbooks from GitHub and the kitchen converge process throws the error:

Error: Failed to install cookbooks from lockfile
Reason: (CookbookOmnifetch::NotACookbook) The resource at ‘/…’ does not appear to be a valid cookbook. Does it have a metadata.rb?

make sure the remote revisions of the dependency cookbook match in the caller and the dependency cookbook’s Policy Lock files and both files are pushed to GitHub.

"scm_info": {
  "scm": "git",
  "remote": "https://github.com/.../....git",
  "revision": "22592d58489abb53316638ce9edfe5ee3742c5cc",

Install Python 3 on MacOS

The MacOS comes with an old version of Python 2. For new software development Python 3 is the recommended version. Replacing the original Python 2 with Python 3 can cause instability in the MacOS. There are multiple ways to install Python 3 and keep Python 2 pn the Mac. This is the most recommended process:

Use multiple Python versions side-by-side

Pyenv

Pyenv is a Python version manager. It is recommended, because it does not depend on Python, (written in Bash) and using it we can install and utilize multiple Python versions without affecting the Python version used by MacOS.

Check the default Python version

Open a new terminal window fo these configuration changes to take effect

python --version

Use virtual environments

Anaconda

Anaconda (conda) can create a python bubble for you with no preinstalled packages. You can create a Python virtual environment for each of your projects to isolate them and only install the required packages.

Integrate Anaconda with Pyenv

If you use Pyenv to install multiple Python versions side-by-side and installed Anaconda to create virtual environments for each of your projects, install pyenv-virtualenv to integrate them.

Troubleshooting

During the installation I have encountered the following error messages

Error: The following directories are not writable by your user:
/usr/local/bin

You should change the ownership of these directories to your user.
sudo chown -R $(whoami) /usr/local/bin

To set you as the owner of the /usr/local/bin directory execute

sudo chown -R $(whoami) /usr/local/bin

Error:
homebrew-core is a shallow clone.
To brew update, first run:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch –unshallow

To update the shallow clone of the repository from GitHub execute

git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow

Error: The following formula cannot be installed from bottle and must be
built from source.
python@2
Install the Command Line Tools:
xcode-select –install

To install the xcode command line developer tools execute

xcode-select --install

Install and configure iTerm2

  1. Download iTerm2 from https://www.iterm2.com/downloads.html
  2. Double click the downloaded ZIP file to extract the application,
  3. Move the iTerm application to Applications.

iTerm2 configuration

Install Oh My Zsh

Oh My Zsh is an open source, community-driven framework for managing your zsh configuration.

  • Install it with
    sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

More info at https://github.com/ohmyzsh/ohmyzsh

Use .bashrc for configuration

When you start iTerm, it reads its own config file, ~/.zshrc To keep using the standard ~/.bashrc config file

  • Add this to the end of the ~/.zshrc file:
    source ~/.bashrc

Enable unlimited scroll back

  1. Start iTerm2 and open the preferences window by pressing ⌘, (command-comma)
  2. On the Profiles, Terminal tab click the Unlimited scrollback check box.

Set the highlight color

By default the highlighted text just a little different from the rest. When we search for something, it is hard to notice the found text.

To change the highlighted text color

  1. Start iTerm
  2. In the iTemr2 menu select Preferences…
  3. On the Profiles, Colors tab set the color of the Selection to red, and Selected Text to black.
     

To start iTerm2 from Finder

This is configured automatically when you install iTerm:

  1. Open Finder and navigate to the location you want to work in,
  2. Right click a folder to work in that folder or a file to work in the current folder
  3. Select ServicesiTerm2 in Finder
 

 Meslo Powerline font

  • Import the Meslo Powerline font with the following bash command:
    git clone https://github.com/powerline/fonts.git && cd fonts && ./install.sh
  • Select the font in iTerm2
    • Press ⌘, (command-comma) to open the Preferences window
    • Select Profiles
    • On the Font section of the Text tab click the Change Font button
    • Select the “Meslo LG L for Powerline”, “Regular”, “12pt”

Make the prompt shorter

to remove your username@computername from the prompt

  • Edit the ~/.bashrc file
  • Add the following line
    DEFAULT_USER="YOUR_USER_NAME"

Colored prompt

To color the prompt:

  • Make sure Oh My Zsh is installed as described above
  • Edit the ~/.bashrc file and set the ZSH_THEME to ZSH_THEME=”agnoster”

More configuration suggestions are at

https://ruigomes.me/blog/perfect-iterm-osx-terminal-installation/
https://gist.github.com/kevin-smets/8568070

Information on how terminals read settings at https://shreevatsa.wordpress.com/2008/03/30/zshbash-startup-files-loading-order-bashrc-zshrc-etc/

Not necessary anymore, for reference only

Set case-insensitive tab completion. This is the default, not necessary.

Add these lines to the ~/.zshrc file

# Set case insensitive comparison when lower case letters are typed.
# Upper case typed letters only match upper case file names
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
autoload -Uz compinit && compinit

“Solarized” color scheme is already installed, these steps are not necessary anymore

  1. Download the color scheme to the Desktop with the following Bash command:
    curl -o ~/Desktop/solarized.itermcolors https://raw.githubusercontent.com/altercation/solarized/master/iterm2-colors-solarized/Solarized%20Dark.itermcolors
  2. Import the color scheme to iTerm2
    • Press ⌘, (command-comma) to open the Preferences window
    • Select Profiles
    • In the lower right corner of the Colors tab click the Color Presets… drop down
    • Select Import
    • On the Desktop select the downloaded solarized.itermcolors file
    • In the  Color Presets… drop down select Solarized Dark

chef push always regenerates the revision id and Policyfile.lock.json

If the chef update and chef push commands always regenerate the Policyfile.lock.json file and the revision_id in it, make sure the Chef cookbook contains the chefignore file and it also references all possible Policyfile lock files:

# Policyfile #
##############
Policyfile.rb
*.lock.json

If a cookbook file changes, a new Policyfile.lock.json is generated during chef push.

chef update and chef push always check the cookbook files not listed in the chefignore file, and if there is a change, regenerate the Policyfile.lock.json including the revision_id element in it.

Failed to complete #create action: [undefined method `[]’ for nil:NilClass] on …

When we launch a test instance with Chef Test Kitchen, we may get the error message:

—–> Starting Test Kitchen (…)
—–> Creating …
——Exception——-
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>> Failed to complete #create action: [undefined method `[]’ for nil:NilClass] on …
>>>>>> ———————-
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running kitchen diagnose --all for configuration

Missing AMI

This can be the result of a missing AWS AMI referenced in the kitchen.yml file. Check if the AMI is still available in the AWS account you are working in.

Tejes vajas fonott császárzsemle

Igazi békebeli fonott császárzsemle receptet találtunk Gábornál.

Hozzávalók

TangZhong (előtészta)
260 ml tej
40 g liszt
összemelegítve.

Az élesztőhöz
230-250 ml tejben
24 g élesztő
egy csipet cukorral felfuttatjuk

A tésztához
650 g finom liszt
10- 12 g só
12 g cukor
35 g vaj

Előkészítés

Felfuttatjuk az élesztőt

Előtészta:
Mielőtt forrni kezdene a tej, lecsökkentjük a hőmérsékletet és gyors keverés mellett lassan beleöntjük a lisztet. Összemelegítjük a lisztet a tejjel, a video szerint, lefedjük, lehűtjük.

Dagasztás

Átszitáljuk a lisztet a dagasztó tálba
hozzáadjuk az előtésztát
A sót, cukrot, A felfuttatott élesztőt
Jól kidagasztjuk
Amikor a tészta szépen felvette a lisztet  és összeállt, hozzáadjuk a vajat
Ha a tészta elkészült, áttesszük egy kiolajozott kelesztő tálba.
A tészta érés ideje a tálban 45 perc

Kivesszük a tésztát és elosztjuk 12-13 db, kb . 95 gr-os darabra
Gömbölyítjük a tésztákat, nem lisztezzük a deszkát
Letakarva 5-10 percet pihentetjük

Megformázzuk a tésztát

Hajtogatjuk, hurkákat készítünk, mint a kalács fonásnál
Kinyújtjuk a hurkákat 40-45 cm hosszúra
Vékonyan belisztezzük a deszka hátsó részét
fonás előtt meghempergetjük a tésztát, hogy ne tapadjon össze
Hurkot kötünk, hogy megformázzuk a császárzsemlét
Sütőpapírral bélelt tepsire tesszük a felét, egy másik tepsire a másik
felét
Leterítjük egy konyharuhával és egy műanyag fóliát (zacskót) teszünk rá
Kelesztés 50-70 perc

Sütés

A sütőt előmelegítjük 230 C °-ra, alsó-felső sütésre, az aljába vizet teszünk egy edényben.


Sütés előtt, mielőtt a sütőbe tesszük, a tésztákat vízzel átspricceljük.
Betesszük a tepsit a sütőbe, 210 C°-ra csökkentjük a hőmérsékletet, 16-20 percig sütjük,  a vizet 12 perc után eltávolítjuk.
Ha a zsemlék alja nem sült meg eléggé, a zsemléket letakarhatjuk alufóliával, esetleg lejjebb tesszük a tepsit, így sütjük 4-8 percig ( 16-20 perc összesen )


Sütés után ismét vízzel lespricceljük.

Gábor web oldalalán minden receptjét megtaláljátok: gaborahazipek.hu

Gábor videóját itt láthatjátok

Friss élesztő és szárított élesztő összehasonlítása

A legegyszerűbben a következő formulával hasonlíthatjuk össze a friss élesztőt és a szárított élesztőt:

1 g szárított élesztő 3 g friss élszetőnek felel meg.

Ha nincs eléggé érzékeny mérlegünk, 1 teáskanál ( 3 g ) szárított élesztő 9 g friss élesztőnek felel meg.

extra characters at the end of n command

When you use sed to insert a template file into another file with the command

# $1 String to insert
# $2 File to insert to
# $3 String to insert after
sed  "/$3/a\\
$1\\
" $2 > tmp && mv tmp $2	

and get the error message

extra characters at the end of n command

Make sure the template file supplied in $1 does not have an empty line at the top.

Test Chef cookbooks with Docker containers

Kitchen Dokken is a provisioner to test cookbooks in Docker containers. It is very fast and efficient compared to cloud instances like AWS EC2s, Vagrant boxes, or VMWare virtual machines.

Currently, you can only test Linux cookbooks with Kitchen Dokken.

To generate a cookbook with the dokken provisioner use the –kitchen option

chef generate cookbook MY_COOKBOOK_NAME --kitchen dokken

The Kitchen Dokken GitHub repository contains more information at https://github.com/test-kitchen/kitchen-dokken

Sample kitchen.yml file with kitchen dokken provisioner at https://github.com/chef-cookbooks/sudo/blob/master/kitchen.dokken.yml

Webinar links at https://www.chef.io/webinars

Silence unknown callers

The new iPhone operating system includes a feature to send all unwanted calls directly to the voicemail. This eliminates the daily car warranty spam calls. If someone calls you from a number that is in your contact list, in your recent outgoing call list, or in a Siri suggestion, the call rings your phone, otherwise it is immediately forwarded to the voicemail. If it was an important call, the caller can leave a message and you can call them back.

To configure your iPhone

  • open Settings
  • select Phone
  • select Silence Unknown Callers
  • slide the switch on the page to show green background