Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Chef Infrastructure Automation Cookbook Second Edition
Chef Infrastructure Automation Cookbook Second Edition

Chef Infrastructure Automation Cookbook Second Edition: Over 80 recipes to automate your cloud and server infrastructure with Chef and its associated toolset

eBook
€20.98 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Chef Infrastructure Automation Cookbook Second Edition

Chapter 2. Evaluating and Troubleshooting Cookbooks and Chef Runs

"Most people spend more time and energy going around problems than in trying to solve them."

Henry Ford

In this chapter, we'll cover the following recipes:

  • Testing your Chef cookbooks
  • Flagging problems in your Chef cookbooks
  • Test-driven development for cookbooks using ChefSpec
  • Integration testing your Chef cookbooks with Test Kitchen
  • Showing affected nodes before uploading cookbooks
  • Overriding a node's run list to execute a single recipe
  • Using why-run mode to find out what a recipe might do
  • Debugging Chef client runs
  • Inspecting the results of your last Chef run
  • Raising and logging exceptions in recipes
  • Diff-ing cookbooks with knife
  • Using community exception and report handlers
  • Creating custom handlers

Introduction

Developing cookbooks and making sure your nodes converge to the desired state is a complex endeavor. You need transparency about what is really happening. This chapter will cover a lot of ways to see what's going on and make sure that everything is working as it should. From running basic checks on your cookbooks to a fully test driven development approach, we'll see what the Chef ecosystem has to offer.

Testing your Chef cookbooks

You know how annoying this is: you tweak a cookbook, upload it to your Chef server, start a Chef run on your node and, boom! It fails. What's even more annoying is that it fails not because a black hole absorbed your node and the whole data center that node lives in, but because you missed a mundane comma in the default recipe of the cookbook you just tweaked. Fortunately, there's a very quick and easy way to find such simple glitches before you go all in and try to run your cookbooks on real nodes.

Getting ready

Install the ntp cookbook by running the following code:

mma@laptop:~/chef-repo $ knife cookbook site install ntp
Installing ntp to /Users/mma/work/chef-repo/cookbooks
…TRUNCATED OUTPUT…
Cookbook ntp version 1.7.0 successfully installed

How to do it...

Carry out the following steps to test your cookbooks:

  1. Run knife cookbook test on a working cookbook, for example, the ntp cookbook:
    mma@laptop:~/chef-repo $ knife cookbook test ntp
    
    checking...

Flagging problems in your Chef cookbooks

Writing solid Chef recipes can be quite challenging. There are a couple of pitfalls, which you can easily overlook. Also, writing cookbooks in a consistent style is even harder. You might wonder what the proven ways to write cookbooks are. Foodcritic tries to identify possible issues with the logic and style of your cookbooks.

In this section, you'll learn how to use Foodcritic on some existing cookbooks.

Getting ready

Install the mysql cookbook by running the following code:

mma@laptop:~/chef-repo $ knife cookbook site install mysql 6.0.0
Installing mysql to /Users/mma/work/chef-repo/cookbooks
…TRUNCATED OUTPUT…
Cookbook mysql version 6.0.0 successfully installed

How to do it...

Let's see how Foodcritic reports findings:

  1. Run foodcritic on your cookbook:
    mma@laptop:~/chef-repo $ foodcritic ./cookbooks/my
    sql
    
    ...TRUNCATED OUTPUT...
    FC001: Use strings in preference to symbols to access node attributes: ./cookbooks/mysql/libraries/helpers...

Test-driven development for cookbooks using ChefSpec

Test-driven development (TDD) is a way to write unit tests before writing any recipe code. By writing the test first, you design what your recipe should do and ensure that your test is for real because it should fail, as long as you haven't written your recipe code.

As soon as you've completed your recipe, your unit tests should pass.

ChefSpec is built on the popular RSpec framework and offers a tailored syntax to test Chef recipes.

Let's develop a very simple recipe using the TDD approach with ChefSpec.

Getting ready

Make sure you have a cookbook called my_cookbook and run_list of your node includes my_cookbook, as described in the Creating and using cookbooks recipe in Chapter 1, Chef Infrastructure.

How to do it...

Let's write a failing test first and then a recipe, which will pass the test:

  1. Create the spec directory for your cookbook:
    mma@laptop:~/chef-repo $ mkdir cookbooks/my_cookbook/spec
    
  2. Create your spec file:
    mma@laptop...

Integration testing your Chef cookbooks with Test Kitchen

Verifying that your cookbooks really work when converging a node is essential. Only if you can trust your cookbooks, you are ready to run them anytime on your production servers.

Test Kitchen is Chef's integration testing framework. It enables you to write tests, which run after a VM is instantiated and converged, using your cookbook. Your tests run in that VM and can verify that everything works as expected.

This is in contrast to ChefSpec, which only simulates a Chef run. Test Kitchen boots up a real node and runs Chef on it. Your tests see the real thing.

Let's see how you can write such integration tests for your cookbooks.

Getting ready

Make sure you have a cookbook named my_cookbook, as described in the Creating and using cookbooks recipe in Chapter 1, Chef Infrastructure.

Make sure you have Vagrant installed, as described in the Managing virtual machines with Vagrant recipe in Chapter 1, Chef Infrastructure.

How to do it...

Showing affected nodes before uploading cookbooks

You know how it goes. You tweak a cookbook to support your new server and upload it to your Chef server. Your new node converges just fine and you're happy. Well, until your older production server picks up your modified cookbook during an automated Chef client run and spits its guts at you. Obviously, you forgot that your old production server was still using the cookbook you tweaked. Luckily, there is the knife preflight command, which can show you all the nodes using a certain cookbook before you upload it to your Chef server.

Getting ready

For the following example, we assume that you have at least one role using the ntp cookbook in its run list and that you have multiple servers with this role and/or the ntp cookbook in their run list directly.

Use Chef to install the knife-preflight gem:

mma@laptop:~/chef-repo $ chef gem install knife-preflight
Fetching gem metadata from https://rubygems.org/
...TRUNCATED OUTPUT...
Installing knife...

Introduction


Developing cookbooks and making sure your nodes converge to the desired state is a complex endeavor. You need transparency about what is really happening. This chapter will cover a lot of ways to see what's going on and make sure that everything is working as it should. From running basic checks on your cookbooks to a fully test driven development approach, we'll see what the Chef ecosystem has to offer.

Testing your Chef cookbooks


You know how annoying this is: you tweak a cookbook, upload it to your Chef server, start a Chef run on your node and, boom! It fails. What's even more annoying is that it fails not because a black hole absorbed your node and the whole data center that node lives in, but because you missed a mundane comma in the default recipe of the cookbook you just tweaked. Fortunately, there's a very quick and easy way to find such simple glitches before you go all in and try to run your cookbooks on real nodes.

Getting ready

Install the ntp cookbook by running the following code:

mma@laptop:~/chef-repo $ knife cookbook site install ntp
Installing ntp to /Users/mma/work/chef-repo/cookbooks
…TRUNCATED OUTPUT…
Cookbook ntp version 1.7.0 successfully installed

How to do it...

Carry out the following steps to test your cookbooks:

  1. Run knife cookbook test on a working cookbook, for example, the ntp cookbook:

    mma@laptop:~/chef-repo $ knife cookbook test ntp
    
    checking ntp
    Running syntax...

Flagging problems in your Chef cookbooks


Writing solid Chef recipes can be quite challenging. There are a couple of pitfalls, which you can easily overlook. Also, writing cookbooks in a consistent style is even harder. You might wonder what the proven ways to write cookbooks are. Foodcritic tries to identify possible issues with the logic and style of your cookbooks.

In this section, you'll learn how to use Foodcritic on some existing cookbooks.

Getting ready

Install the mysql cookbook by running the following code:

mma@laptop:~/chef-repo $ knife cookbook site install mysql 6.0.0
Installing mysql to /Users/mma/work/chef-repo/cookbooks
…TRUNCATED OUTPUT…
Cookbook mysql version 6.0.0 successfully installed

How to do it...

Let's see how Foodcritic reports findings:

  1. Run foodcritic on your cookbook:

    mma@laptop:~/chef-repo $ foodcritic ./cookbooks/my
    sql
    
    ...TRUNCATED OUTPUT...
    FC001: Use strings in preference to symbols to access node attributes: ./cookbooks/mysql/libraries/helpers.rb:273
    FC005: Avoid...

Test-driven development for cookbooks using ChefSpec


Test-driven development (TDD) is a way to write unit tests before writing any recipe code. By writing the test first, you design what your recipe should do and ensure that your test is for real because it should fail, as long as you haven't written your recipe code.

As soon as you've completed your recipe, your unit tests should pass.

ChefSpec is built on the popular RSpec framework and offers a tailored syntax to test Chef recipes.

Let's develop a very simple recipe using the TDD approach with ChefSpec.

Getting ready

Make sure you have a cookbook called my_cookbook and run_list of your node includes my_cookbook, as described in the Creating and using cookbooks recipe in Chapter 1, Chef Infrastructure.

How to do it...

Let's write a failing test first and then a recipe, which will pass the test:

  1. Create the spec directory for your cookbook:

    mma@laptop:~/chef-repo $ mkdir cookbooks/my_cookbook/spec
    
  2. Create your spec file:

    mma@laptop:~/chef-repo ...

Integration testing your Chef cookbooks with Test Kitchen


Verifying that your cookbooks really work when converging a node is essential. Only if you can trust your cookbooks, you are ready to run them anytime on your production servers.

Test Kitchen is Chef's integration testing framework. It enables you to write tests, which run after a VM is instantiated and converged, using your cookbook. Your tests run in that VM and can verify that everything works as expected.

This is in contrast to ChefSpec, which only simulates a Chef run. Test Kitchen boots up a real node and runs Chef on it. Your tests see the real thing.

Let's see how you can write such integration tests for your cookbooks.

Getting ready

Make sure you have a cookbook named my_cookbook, as described in the Creating and using cookbooks recipe in Chapter 1, Chef Infrastructure.

Make sure you have Vagrant installed, as described in the Managing virtual machines with Vagrant recipe in Chapter 1, Chef Infrastructure.

How to do it...

Let's create...

Showing affected nodes before uploading cookbooks


You know how it goes. You tweak a cookbook to support your new server and upload it to your Chef server. Your new node converges just fine and you're happy. Well, until your older production server picks up your modified cookbook during an automated Chef client run and spits its guts at you. Obviously, you forgot that your old production server was still using the cookbook you tweaked. Luckily, there is the knife preflight command, which can show you all the nodes using a certain cookbook before you upload it to your Chef server.

Getting ready

For the following example, we assume that you have at least one role using the ntp cookbook in its run list and that you have multiple servers with this role and/or the ntp cookbook in their run list directly.

Use Chef to install the knife-preflight gem:

mma@laptop:~/chef-repo $ chef gem install knife-preflight
Fetching gem metadata from https://rubygems.org/
...TRUNCATED OUTPUT...
Installing knife-preflight...

Overriding a node's run list to execute a single recipe


We all have those snowflake environments that are built using Chef, but we're not comfortable with running the Chef client anymore. We know that some cookbooks have been enhanced but never tested against this specific environment. The risk of bringing it down by a Chef client run is pretty high.

However, even though we do not dare do a full Chef client run, we might need to run, for example, the users cookbook, in order to add a new colleague to our snowflake environment. This is where Chef client's feature to override a run list to execute a single recipe comes in very handy.

Note

Don't overuse this feature! Make sure you fix your environment so that you're comfortable to run Chef client whenever you need to!

Getting ready

To follow along with the following example, you'll need a node hooked up to your Chef server having multiple recipes and/or roles in its run list.

How to do it...

Let's see how to run a single recipe out of a bigger run...

Using why-run mode to find out what a recipe might do


why-run mode lets each resource tell you what it would do during a Chef client run, assuming certain prerequisites. This is great because it gives you a glimpse about what might really happen on your node when you run your recipe for real.

However, because Chef converges a lot of resources to a desired state, why-run will never be accurate for a complete run. Nevertheless, it might help you during development while you're adding resources step-by-step to build the final recipe.

In this section, we'll try out why-run mode to see what it tells us about our Chef client runs.

Getting ready

To try out why-run mode, you need a node where you can execute the Chef client and at least one cookbook that is available on that node.

How to do it...

Let's try to run the ntp cookbook in why-run mode:

  1. Override the current run list to run the ntp recipe in why-run mode on a brand new box:

    user@server:~$ sudo chef-client -o 'recipe[ntp]' --why-run
    
    ...TRUNCATED...
Left arrow icon Right arrow icon

Description

This book is for system engineers and administrators who have a fundamental understanding of information management systems and infrastructure. It helps if you've already played around with Chef; however, this book covers all the important topics you will need to know. If you don't want to dig through a whole book before you can get started, this book is for you, as it features a set of independent recipes you can try out immediately.

What you will learn

  • Set up your local development and testing environment for Chef
  • Debug your cookbooks and Chef runs by using the numerous inspection and logging facilities of Chef
  • Drive your cookbooks from external data or nodespecific attributes
  • Manage and scale your cloud infrastructure by automating your configuration management
  • Extend Chef to meet your advanced needs by creating custom plugins for knife and Ohai
  • Test your Chef cookbooks and infrastructure by writing examples
Estimated delivery fee Deliver to Luxembourg

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : May 29, 2015
Length: 278 pages
Edition : 1st
Language : English
ISBN-13 : 9781785287947
Vendor :
Chef
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Luxembourg

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

Product Details

Publication date : May 29, 2015
Length: 278 pages
Edition : 1st
Language : English
ISBN-13 : 9781785287947
Vendor :
Chef
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 73.98
Chef Infrastructure Automation Cookbook Second Edition
€36.99
Mastering Chef
€36.99
Total 73.98 Stars icon
Banner background image

Table of Contents

8 Chapters
1. Chef Infrastructure Chevron down icon Chevron up icon
2. Evaluating and Troubleshooting Cookbooks and Chef Runs Chevron down icon Chevron up icon
3. Chef Language and Style Chevron down icon Chevron up icon
4. Writing Better Cookbooks Chevron down icon Chevron up icon
5. Working with Files and Packages Chevron down icon Chevron up icon
6. Users and Applications Chevron down icon Chevron up icon
7. Servers and Cloud Infrastructure Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.7
(6 Ratings)
5 star 50%
4 star 16.7%
3 star 0%
2 star 16.7%
1 star 16.7%
Filter icon Filter
Top Reviews

Filter reviews by




Michael Aug 08, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I really like this book so far. I was concerned that the recipe format would not be best for a beginner but it has great step-by-step guides in here that will bring you up to speed quickly. Highly recommend for those just learning Chef.
Amazon Verified review Amazon
John D. Aug 09, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
It helps to have a basic understanding of how Chef works before this book is really valuable, and this book could be summed up as chapters full of bite-sized mini-HOWTOs that help you get from basic knowledge to really knowing your way around.I use Chef a lot, and really enjoyed reading the first edition of this book, and I hadn't used Chef a whole ton back then. Upon reading the second edition, I'm still able to have some "a-ha" moments, and further my understanding. Another great way to think about this book is a substitute for the Chef documentation - it's a great cheat sheet for some of the most common tasks you'll perform.Some of the only quirks (should only impact novice to intermediate users):- the lack of visual representations, but this will matter a lot less if you have some experience- the mini-HOWTO (my description) sections have 'how it works' subsections at the end - you may want to skip ahead if things don't make sense- it would also really help to have a basic understanding of git and vagrant before startingSide note: this is in the upper 5% of Packt Publishing books I've readTL;DR: a must-have resource for any Chef user, and the only books that compare in any way are the O'Reilly books on Chef
Amazon Verified review Amazon
Antonio Dec 22, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Very helpful reading. I have worked with Ansible an Salt before and this book got me up to speed with Chef. Of course, it's not deeply elaborating specific points but if you already have knowledge of configuration management this will help you to catch up quickly.
Amazon Verified review Amazon
Jean Remy Aug 05, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
This book has a lot of great examples which helped me tremendously testing some of the recipes. As an intermediate user it was fairly easy to work my way through the chapters. However, this book is not for a novice user since it does not have a lot of diagrams to explain visually the overall intent of each recipes.
Amazon Verified review Amazon
Matthew Dresden Dec 21, 2016
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
This is too far out of date to be of any practical use, but unfortunately this is the case for all Chef books.Chefs docs and Github are the only place worth looking at, plus someone who already knows chef.It would otherwise be a very long painful process to real use chef appropriately.It advises against wrapping, which is now the standard.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact [email protected] with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at [email protected] using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on [email protected] with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on [email protected] within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on [email protected] who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on [email protected] within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela