Sunday, February 11, 2018

Solution for Box not found error in Vagrant



I was facing this error:

The box 'centos/7' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Atlas, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:

URL: ["https://atlas.hashicorp.com/centos/7"]
Error: The requested URL returned error: 404 Not Found



Adding this line in Vagrantfile helped:

++Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
Vagrant.configure("2") do |config|


source: https://github.com/hashicorp/vagrant/issues/9442#issuecomment-363080565

Wednesday, February 7, 2018

multiple commits in a PR




I ended up with multiple commits in my PR after a rebase (and followup push) in my "working" branch.


Solution:

I first copied those few files which I have modified/ added into a temp directory (along with entire path).

then reset my branch with origin/master.

git reset --hard origin/master

So, now the "working" branch is in sync with master branch.



Now, copy back all those files from temp directory into the "working" branch.

Carried out a fresh commit with all changes and verified all changes looks fine.


Then, just did a force push as :

git push --force

Now, you can check in github whether only one commit with required changes present.

Lesson:
Always verify git status before a push especially after a rebase.

PS: not an optimal solution, but manual way.

Monday, February 5, 2018

store vagrant boxes in custom directory



By default vagrant stores  boxes here at ~/.vagrant.d/boxes

Sometimes, we want to make use of custom location instead of above.
you can make use of VAGRANT_HOME directory.



export VAGRANT_HOME=/path/to/yourown/location

You can make it permanent by adding the above in your bashrc file.

link: http://docs.vagrantup.com/v2/other/environmental-variables.html


Monday, January 22, 2018

ansible logging and debugging

============================
If you pass the -v flag to ansible-playbook on the command line, you'll see the stdout and stderr for each task executed:

$ ansible-playbook -v playbook.yaml

You can also choose -vvv for more verbose output.

Check  for more options:
#ansible-playbook --help | less
============================
Ansible also has built-in support for logging.
Add the following lines to your ansible configuration file(/etc/ansible/ansible.cfg):

[defaults]
log_path=/path/to/logfile

============================


Sunday, January 21, 2018

Git aliases


================================
edit ~/.gitconfig as below:

[alias]
        fetch = fetch -v
co = checkout
================================

You can do the same using command line too: (which will in turn update ~/.gitconfig file)

# git config --global alias.co checkout

================================
You can list/verify same using the command

# git config --global -l
...
...
alias.fetch=fetch -v

alias.co=checkout
================================