Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repo specific config? #29

Open
davidpelaez opened this issue Jul 5, 2013 · 6 comments
Open

Repo specific config? #29

davidpelaez opened this issue Jul 5, 2013 · 6 comments

Comments

@davidpelaez
Copy link

Hi.

In our company we'd like to track the sharp config in the repository.We have a knife.rb that we can track in git and we'd like to keep our stack files fully containerized. I forked the current version and see it would be very hard to solve.

However, I wanted to check if there's a specific reason why you have avoided this and if you'd think it'd be useful. Then maybe we could contribute this simple add-on.

Looking forward,

DPT

@josqu4red
Copy link
Contributor

Hi,

By tracking the sharp config, you mean in the same repo as cookbooks and chef things ?
Well, it is just a path problem, isn't it ?

For us it's just another dotfile, so each one tracks it the way he wants...

Not sure to understand the problem

@josqu4red
Copy link
Contributor

Since knife.rb accepts any directive, you can add an option in it, for instance :

sharp_config_path '/path/to/your/sharp-config.yml'

Then, in SharpAlign#setup, if the option is set, add its value to the array of possible configs or even override its content.

Here: https://github.com/Fotolia/knife-sharp/blob/master/lib/chef/knife/sharp-align.rb#L63

@davidpelaez
Copy link
Author

Yeah, I want to have the file in [chef-repo]/config/sharp-config.yml, so I just put in knife.rb the directive you mentioned?

I was going to quit, because I keep getting a "wrong data bag path". The config to the git repo is correct and I just don't know what else to do. I edited the gem locally to show what the path of the problem was, this is the output:

$ knife sharp align master _default -D
WARNING: Bad data bag path /var/chef/data_bags, skipping data bag sync.
Nothing else to do

I have no idea why the path it's using is that one and not the one set in global, git_cookbook_path in the yaml file.

@josqu4red
Copy link
Contributor

About the config path, if you want to put the directive in knife.rb, you have to retrieve it in the code where I mentionned, no magic there :)

About the data bags, the documentation is indeed lacking that very detail, we will update it in the next days.
git_cookbook_path was introduced when the tool only supported cookbook syncing.
To use data bag and role syncing, you have to add those options to your knife config :

cookbook_path            '/home/jamiez/sysadmin/chef/cookbooks'
data_bag_path            '/home/jamiez/sysadmin/chef/data_bags'
role_path                '/home/jamiez/sysadmin/chef/roles'

which default to /var/chef/* if absent. Have a look to SharpAlign#setup for the details.

@josqu4red
Copy link
Contributor

Did you work out something about this ?

@davidpelaez
Copy link
Author

Sorry for the delay! I did manage to have it working as expected regarding the configuration. However, when I went to align the data bags, I couldn't continue because I had no local data bags and only one in the server I think. It seemed like having no local databags was considered an error. I wanted to save time in handling data bags and ensuring some extra order in our process but this was for a very very fast project and I run out of time to try new things so I kept it very manual without knife-sharp :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants