Hi,

I'm trying to bootstrap one predefined recipe as runlist through JClouds
boot strap. The issue I'm facing is the authentication and chef-validator
pem file all the generating correctly in ec2 node, but it's failing to
create the client.pem in the new node. For that the recipe is not able to
run. Below is my code part following the example from link
https://github.com/jclouds/jclouds-examples/blob/master/chef-basics/src/main/java/org/apache/jclouds/examples/chef/basics/MainApp.java

Please let me know the whats the issue here.


private String createBootstrapAWS(String userName, String password,
> InstanceBean instance, ComputeService computeService)
> throws IOException {
> String status = Constants.SUCCESS;
> List<String> runlist = new ArrayList<String>();
> String recipe = INITIAL_UPDATE_VM;
> // initialising chef
> ChefContext chefContext = AriServiceConfiguration
> .chefServerConfigurationCloudWise(instance);
> Iterable<? extends CookbookVersion> cookbookVersions = chefContext
> .getChefService().listCookbookVersions();
> if (any(cookbookVersions, containsRecipe(recipe))) {
> runlist = new RunListBuilder().addRecipe(recipe).build();
> }
> if (instance.isAutoDeploy()) {
> runlist = new RunListBuilder().addRecipes(
> instance.getRecipes().toArray(
> new String[instance.getRecipes().size()])).build();
> }
> LoginCredentials login = getLoginForCommandExecution(userName,
> password, instance.getCloudType());
> LOG.info("got the login as :" + login);
> ChefService chefService = initChefServiceAWS(
> MessageTranslator.getMessage("chef.client"),
> MessageTranslator.getMessage("chef.validator"));
> BootstrapConfig build = null;
> try {
> build = BootstrapConfig.builder().runList(runlist).build();
> chefService.updateBootstrapConfigForGroup(instance.getGroupName(),
> build);
> // Build the script that will bootstrap the node
> Statement bootstrap = chefService
> .createBootstrapScriptForGroup(instance.getGroupName());
> LOG.info("bootstrap created...");
> LOG.debug("Running run script");
> status = runScriptOnGroup(computeService, login, instance,
> bootstrap);
> } catch (Exception e) {
> LOG.warn("error thrown for bootstrap.." + e.getMessage());
> return "failure";
> } finally {
> chefContext.close();
> }
> return status;
> }



The response I'm getting from JClouds for ExecResponse  is below. It's not
creating the client.pem.  Please let me know what is the issue here.

ExecResponse execResponses1 = compute.runScriptOnNode(
> instance.getInstanceId(), command,
> overrideLoginCredentials(login).runAsRoot(true));


{output=Downloading Chef  for el...
downloading
https://www.opscode.com/chef/metadata?v=&prerelease=false&nightlies=false&p=el&pv=6&m=x86_64
  to file /tmp/install.sh.2830/metadata.txt
trying wget...
url
https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.0.3-1.x86_64.rpm
md5 3634d1a3b6ae2e5977361075da0f44cc
sha256 0ec6162b9d0ca2b2016ff02781d84905f712d64c7a81d01b0df88f977832f310
downloaded metadata file looks valid...
downloading
https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.0.3-1.x86_64.rpm
  to file /tmp/install.sh.2830/chef-12.0.3-1.x86_64.rpm
trying wget...
Comparing checksum with sha256sum...
Installing Chef
installing with rpm...
Preparing...
 ##################################################
chef
 ##################################################
Thank you for installing Chef!
[2015-02-08T17:41:25+00:00] INFO: Forking chef instance to converge...
[2015-02-08T17:41:25+00:00] INFO: *** Chef 12.0.3 ***
[2015-02-08T17:41:25+00:00] INFO: Chef-client pid: 7023
[2015-02-08T17:41:28+00:00] INFO:* Client key /etc/chef/client.pem is not
present - registering*
*, error=warning: /tmp/install.sh.2830/chef-12.0.3-1.x86_64.rpm: Header V4
DSA/SHA1 Signature, key ID 83ef826a: NOKEY*
*, exitStatus=1}*


Regards,
Subhadip

-------------------------------------------------------------------------------------------------------------------

Reply via email to