[ 
https://issues.apache.org/jira/browse/JCLOUDS-3?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13653561#comment-13653561
 ] 

Jayant Kaushal commented on JCLOUDS-3:
--------------------------------------

Hi went through the API,
could you help me out how do i pass the environment in API and then how do i 
use the environment databag item to integrate with chef.
please take a look at my test.

@Test
  public void bootStrapChefClientWithRunlist() throws Exception {
    // Get the credentials that will be used to authenticate to the Chef server
    String client = "org_dev-validator";
    String organization = "org_dev";
    String credential = null;
    try {
      credential = Files.toString(new 
File("/home/jayant/chef-repo/.chef/org_dev-validator.pem"), Charsets.UTF_8);
    } catch(IOException e) {
      e.printStackTrace();
    }
    String validator = organization + "-validator";
    String group = "group";
    Properties chefConfig = new Properties();
    chefConfig.put(ChefProperties.CHEF_VALIDATOR_NAME, validator);
    ChefContext chefContext = 
ContextBuilder.newBuilder("chef").endpoint("https://api.opscode.com/organizations/";
 + organization).credentials(client, credential).overrides(chefConfig).build();
    Statement bootstrap = 
chefContext.getChefService().createBootstrapScriptForGroup(group);
    RunListBuilder runListBuilder = new RunListBuilder();
    List<String> runlist = runListBuilder.addRecipe("apache2").build();
    chefContext.getChefService().updateBootstrapConfigForGroup(runlist, group);
    ComputeService computeService = initializeComputeService();
    String nodeId = "i-1f1e8047";
    String cloudCredential = null;
    try {
      cloudCredential = Files.toString(new 
File("/home/jayant/Downloads/group.pem"), Charsets.UTF_8);
    } catch(IOException e) {
      e.printStackTrace();
    }
    LoginCredentials credentials = 
LoginCredentials.builder().user("ec2-user").privateKey(cloudCredential).build();
    ExecResponse execResponse = computeService.runScriptOnNode("i-1f1e8047", 
bootstrap,            
RunScriptOptions.Builder.overrideLoginCredentials(credentials).blockOnComplete(true).runAsRoot(true));
    //        Set<? extends NodeMetadata> nodes = 
computeService.createNodesInGroup(group, 1, runScript(bootstrap));
    //    ExecResponse response = computeService.runScriptOnNode("i-10e77b7c", 
bootstrap);
    //    System.out.println("response = " + response);
  }
                
> Jcloud support for custom chef environment.
> -------------------------------------------
>
>                 Key: JCLOUDS-3
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-3
>             Project: jclouds
>          Issue Type: New Feature
>            Reporter: Jayant Kaushal
>            Assignee: Ignasi Barrera
>
> Jcloud support for custom chef environment.
> Trying to bootstrap a node in a different environment that _default.
> Is there a support for that 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to