Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2015-03-24 Thread Everett Toews
@demobox Can this be closed?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63#issuecomment-85717848

Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-30 Thread najtmar
Rebased and squashed.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63#issuecomment-57283641

Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-30 Thread Andrew Phillips
Committed to 
[master](https://git-wip-us.apache.org/repos/asf?p=jclouds-examples.git;a=commit;h=b183a18747d7bce8f51bc05fc70acfa2cb5edfcd).
 Thanks, @najtmar!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63#issuecomment-57308421

Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-29 Thread najtmar
What do you think about this PR now?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63#issuecomment-57139001

Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-29 Thread Andrew Phillips
 What do you think about this PR now?

+1, looks good to me. Thanks, @najtmar! Now just for a squash'n'rebase, and 
then I think we should be good to merge this!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63#issuecomment-57246372

Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-22 Thread najtmar
String instanceName = args[2];
String zone = args[3];
 -  String googleUserName = args[4];
 -  String sshPrivateKey = Files.toString(new File(args[5]), 
 Charset.defaultCharset());
 +  String userName = System.getProperty(user.name);
 +  String sshPrivateKeyFileName = System.getProperty(user.home) + 
 /.ssh/google_compute_engine;

Done.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63/files#r17841423

Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-19 Thread najtmar
 @@ -26,7 +26,7 @@
namegoogle-examples/name
  
properties
 -jclouds.version1.7.2/jclouds.version
 +jclouds.version1.8.0/jclouds.version

What do you think about this change?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63/files#r17773096

Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-19 Thread Jeremy Daggett
 @@ -26,7 +26,7 @@
namegoogle-examples/name
  
properties
 -jclouds.version1.7.2/jclouds.version
 +jclouds.version1.8.0/jclouds.version

@najtmar If you have run the examples successfully against `1.8.0`, then I 
would argue that this change is preferred over `1.7.2`.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63/files#r17786175

Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-19 Thread Andrew Phillips
String instanceName = args[2];
String zone = args[3];
 -  String googleUserName = args[4];
 -  String sshPrivateKey = Files.toString(new File(args[5]), 
 Charset.defaultCharset());
 +  String userName = System.getProperty(user.name);
 +  String sshPrivateKeyFileName = System.getProperty(user.home) + 
 /.ssh/google_compute_engine;

 Do you think it makes sense to replace '/' with File.separator ?

Yes ;-)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63/files#r17817315

Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-19 Thread Andrew Phillips
@najtmar Thanks for the updates! `File.separator` sounds like a good idea...

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63#issuecomment-56254657

Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-07 Thread najtmar
 + System.err.println(Cannot open your SSH public key at  + 
 sshPublicKeyFileName
 ++ \nIt is required to authorize your access to the 
 machine.\n
 ++ See 
 https://developers.google.com/compute/docs/instances#sshkeys for more 
 details.\n
 ++ e.getMessage());
 + System.exit(1);
 +  }
 +  String sshPrivateKeyFileName = System.getProperty(user.home) + 
 /.ssh/google_compute_engine;
 +  String sshPrivateKey = null;
 +  try {
 + sshPrivateKey = Files.toString(new File(sshPrivateKeyFileName), 
 Charset.defaultCharset());
 +  } catch (IOException e) {
 + System.err.println(Cannot open your SSH private key at  + 
 sshPrivateKeyFileName
 ++ \nIt is required to perform any operations on your 
 machine via SSH.\n
 ++ See 
 https://developers.google.com/compute/docs/instances#sshkeys for more 
 details.\n
 ++ e.getMessage());
 + System.exit(1);

Done.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63/files#r17213532

Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-07 Thread najtmar
String instanceName = args[2];
String zone = args[3];
 -  String googleUserName = args[4];
 -  String sshPrivateKey = Files.toString(new File(args[5]), 
 Charset.defaultCharset());
 +  String userName = System.getProperty(user.name);
 +  String sshPrivateKeyFileName = System.getProperty(user.home) + 
 /.ssh/google_compute_engine;

I checked it in come docs: the files should be put in %HOMEPATH%\.ssh

Do you think it makes sense to replace '/' with File.separator ?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63/files#r17213536

Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-07 Thread najtmar
 @@ -26,7 +26,7 @@
namegoogle-examples/name
  
properties
 -jclouds.version1.7.2/jclouds.version
 +jclouds.version1.8.0/jclouds.version

I figured out that https://issues.apache.org/jira/browse/JCLOUDS-620 is still 
not fixed in 1.7.2. This is why I propose upgrading to 1.8.0.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63/files#r17213553

[jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-06 Thread najtmar

You can merge this Pull Request by running:

  git pull https://github.com/najtmar/jclouds-examples master

Or you can view, comment on it, or merge it online at:

  https://github.com/jclouds/jclouds-examples/pull/63

-- Commit Summary --

  * Simplify interface of Google examples and fix the name and comment of 
userName variable.

-- File Changes --

M 
google/src/main/java/org/jclouds/examples/google/computeengine/CreateServer.java
 (57)
M 
google/src/main/java/org/jclouds/examples/google/computeengine/ExecuteCommand.java
 (40)

-- Patch Links --

https://github.com/jclouds/jclouds-examples/pull/63.patch
https://github.com/jclouds/jclouds-examples/pull/63.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63


Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-06 Thread Andrew Phillips
 + System.err.println(Cannot open your SSH public key at  + 
 sshPublicKeyFileName
 ++ \nIt is required to authorize your access to the 
 machine.\n
 ++ See 
 https://developers.google.com/compute/docs/instances#sshkeys for more 
 details.\n
 ++ e.getMessage());
 + System.exit(1);
 +  }
 +  String sshPrivateKeyFileName = System.getProperty(user.home) + 
 /.ssh/google_compute_engine;
 +  String sshPrivateKey = null;
 +  try {
 + sshPrivateKey = Files.toString(new File(sshPrivateKeyFileName), 
 Charset.defaultCharset());
 +  } catch (IOException e) {
 + System.err.println(Cannot open your SSH private key at  + 
 sshPrivateKeyFileName
 ++ \nIt is required to perform any operations on your 
 machine via SSH.\n
 ++ See 
 https://developers.google.com/compute/docs/instances#sshkeys for more 
 details.\n
 ++ e.getMessage());
 + System.exit(1);

Any way to combine both of these try blocks, since it's basically the same 
error message?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63/files#r17208871

Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-06 Thread Andrew Phillips
String instanceName = args[2];
String zone = args[3];
 -  String googleUserName = args[4];
 -  String sshPrivateKey = Files.toString(new File(args[5]), 
 Charset.defaultCharset());
 +  String userName = System.getProperty(user.name);
 +  String sshPrivateKeyFileName = System.getProperty(user.home) + 
 /.ssh/google_compute_engine;

Does it make sense to mandate this location? Is it so inconvenient to pass this 
as a parameter? Or is it _clear_ that everyone will have the file in this 
location?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63/files#r17208877

Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-06 Thread najtmar
String instanceName = args[2];
String zone = args[3];
 -  String googleUserName = args[4];
 -  String sshPrivateKey = Files.toString(new File(args[5]), 
 Charset.defaultCharset());
 +  String userName = System.getProperty(user.name);
 +  String sshPrivateKeyFileName = System.getProperty(user.home) + 
 /.ssh/google_compute_engine;

A standard tool gcloud creates these files and puts them in these locations 
(see https://developers.google.com/compute/docs/instances#sshkeys). Situations 
when they are located elsewhere should be very rare. I think that it's very 
inconvenient for a user having to enter the paths each time as command-line 
arguments, this is why I suggest hardcoding the locations in this example.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63/files#r17209408

Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-06 Thread najtmar
 + System.err.println(Cannot open your SSH public key at  + 
 sshPublicKeyFileName
 ++ \nIt is required to authorize your access to the 
 machine.\n
 ++ See 
 https://developers.google.com/compute/docs/instances#sshkeys for more 
 details.\n
 ++ e.getMessage());
 + System.exit(1);
 +  }
 +  String sshPrivateKeyFileName = System.getProperty(user.home) + 
 /.ssh/google_compute_engine;
 +  String sshPrivateKey = null;
 +  try {
 + sshPrivateKey = Files.toString(new File(sshPrivateKeyFileName), 
 Charset.defaultCharset());
 +  } catch (IOException e) {
 + System.err.println(Cannot open your SSH private key at  + 
 sshPrivateKeyFileName
 ++ \nIt is required to perform any operations on your 
 machine via SSH.\n
 ++ See 
 https://developers.google.com/compute/docs/instances#sshkeys for more 
 details.\n
 ++ e.getMessage());
 + System.exit(1);

My idea was to move the description of these files from the class comment block 
to separate error messages. This is why I decided to keep these try blocks 
separate.

If you don't like the idea, I'll combine these blocks and put the description 
of the files in a common comment block.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63/files#r17209431

Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-06 Thread Andrew Phillips
 + System.err.println(Cannot open your SSH public key at  + 
 sshPublicKeyFileName
 ++ \nIt is required to authorize your access to the 
 machine.\n
 ++ See 
 https://developers.google.com/compute/docs/instances#sshkeys for more 
 details.\n
 ++ e.getMessage());
 + System.exit(1);
 +  }
 +  String sshPrivateKeyFileName = System.getProperty(user.home) + 
 /.ssh/google_compute_engine;
 +  String sshPrivateKey = null;
 +  try {
 + sshPrivateKey = Files.toString(new File(sshPrivateKeyFileName), 
 Charset.defaultCharset());
 +  } catch (IOException e) {
 + System.err.println(Cannot open your SSH private key at  + 
 sshPrivateKeyFileName
 ++ \nIt is required to perform any operations on your 
 machine via SSH.\n
 ++ See 
 https://developers.google.com/compute/docs/instances#sshkeys for more 
 details.\n
 ++ e.getMessage());
 + System.exit(1);

 This is why I decided to keep these try blocks separate.

Fair point - they are a little different, indeed. I was just wondering if there 
was some way to reduce the amount of code duplication we now have for just a 
slight difference in error messages. How about putting them in _one_ block with 
a message such as: Unable to load your SSH keys. Please ensure your public 
key, used for X, is at ... and your private key, needed for Y, is at ...?

But also OK to leave as-is - your call.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63/files#r17212126

Re: [jclouds-examples] Simplify interface of Google examples and fix the name and comment of userName variable (#63)

2014-09-06 Thread Andrew Phillips
String instanceName = args[2];
String zone = args[3];
 -  String googleUserName = args[4];
 -  String sshPrivateKey = Files.toString(new File(args[5]), 
 Charset.defaultCharset());
 +  String userName = System.getProperty(user.name);
 +  String sshPrivateKeyFileName = System.getProperty(user.home) + 
 /.ssh/google_compute_engine;

 Situations when they are located elsewhere should be very rare.

OK, then fine to leave this here. Curiosity question: what does `gcloud` do on 
Windows, if that's supported?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/63/files#r17212129