Code Monkey home page Code Monkey logo

azure-scripty's People

Contributors

avladu avatar glennblock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

azure-scripty's Issues

Support programmatic piping

Just let me do this:

var cmds=[
  {cmd:'azure mobile show clidemo', callback:onShow},
  {cmd:'azure mobile create clidemo2'}
];

function onShow(err, result, callback, nextCommand) {
  // do stuff with result
 nextCommand.positional: [result.sqlServer]
 callback(nextCommand);
}

scripty.invoke(cmds, function() { console.log('done'); } );

cannot find module '../node_modules/azure-cli/lib/cli

D:\SourceCode\MOGA\Scripts\Trunk\Provisioning>node VMSetup.js
module.js:341
throw err;
^

Error: Cannot find module '../node_modules/azure-cli/lib/cli'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object. (D:\SourceCode\MOGA\Scripts\Trunk\Provisioning\node_modules\azure-scripty\lib\azure-scripty.js:6:11)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)

stdout maxBuffer exceeded

I'm writing an azure script to retrieve all the blobs in a container, but I'm getting an error - "stdout maxBuffer exceeded."

It's the equivalent to this command line:

 azure storage blob list <container> --account-name <foo> --account-key <bar>
  1. is that by design?
  2. Is there a way to tell scripty to only retrieve certain properties? I don't need a massive JSON response with every blob property (which is what you get if you run that command with --json). A simple list is fine.

Support declarative piping

this would allow piping collection results into the next command that executes. The following cmd would have place holders indicating which values to pipe in.

For example this:

``` javascript````
var scripty = require('azure-scripty');
scripty.invoke(['azure site list','azure site config add foo=bar :name'],
function(err,results) {});


Would grab the list of websites, then loop through each site and add a config setting foo=bar. The :name syntax matches against the 'Name' property for each site.

bug with error callbacks

Hi Glenn,

Right now if a user forgets to add a space between commands.

scripty.invoke('mobile table createservicename', function (err, results) {
console.log(err);
console.log(results);
}

gives err=undefined and results=null.

I tried some other random gibberish commands and it seems like invoke doesn't callback error that Azure CLI runs into.

Thanks!
-Mimi :)

Results are wrapped in an extra array

var cli = require('azure-scripty');
var servicename = 'mymobileservice';

cli.invoke({
command: 'mobile table list',
positional: [servicename]
}, function(err, results) {
console.log(results);
// results is an array in an array
});

Results come back in an additional array

cannot find module '../node_modules/azure-cli/lib/cli

D:\SourceCode\MOGA\Scripts\Trunk\Provisioning>node VMSetup.js
module.js:341
throw err;
^

Error: Cannot find module '../node_modules/azure-cli/lib/cli'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object. (D:\SourceCode\MOGA\Scripts\Trunk\Provisioning\node_modules\azure-scripty\lib\azure-scripty.js:6:11)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)

Add the ability to stream output

For commands that return a large result like listing out blobs, scripty should support being able to stream the output rather than have to buffer.

annot find module '../node_modules/azure-cli/lib/cli

D:\SourceCode\MOGA\Scripts\Trunk\Provisioning>node VMSetup.js
module.js:341
throw err;
^

Error: Cannot find module '../node_modules/azure-cli/lib/cli'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object. (D:\SourceCode\MOGA\Scripts\Trunk\Provisioning\node_modules\azure-scripty\lib\azure-scripty.js:6:11)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)

Problems with VM create

I'm trying to run the following code to create a VM, similar to how I use the "azure vm create" CLI (for a Windows Server 2012 image).

cmd = {
command: 'vm create',
positional: [vmName, imageName, 'administrator', password],
location: location,
rdp: true
};
scripty.invoke(cmd)

The scripts runs for a second or two and then prints:
Error: Command failed: The hosted service is not valid.

If I run the azure cli "vm create" command with the same values (positional and parameters) it works without a problem (the CLI creates a cloud service for the VM).

Any ideas what is wrong with this code?

Allow me to pass in command arguments as properties of an object

I want to be able to do something like this:

var serviceName = 'mymobileservice';
var sqlAdminUser = 'sqladmin';
var sqlAdminPassword = 'myP@ssw0rd!'
var createArgs = {
  sqlServer: 'VMF1ASD',
  sqlDb: 'mydb'
};
scripty.invoke('mobile create', [serviceName, sqlAdminUser, sqlAdminPassword], createArgs, function(err, results) {
   // etc
});

Or this:

var createCommand = {
  command: 'mobile create',
  positional: ['mymobileservice', 'sqladmin', 'myP@ssw0rd!'],
  sqlServer: 'VMF1ASD',
  sqlDb: 'mydb'
}
scripty.invoke(createCommand, function(err, results) {
   // etc
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.