Wildcard in variable name - octopus-deploy

I have a use case where I want to do array indexing for the name of some variables. In this case, I want all of these to direct to the same value:
ReverseProxy:Routes:0:Match:Hosts:0 = MyDomain.com
ReverseProxy:Routes:1:Match:Hosts:0 = MyDomain.com
ReverseProxy:Routes:2:Match:Hosts:0 = MyDomain.com
ReverseProxy:Routes:3:Match:Hosts:0 = MyDomain.com
Is it possible have a wildcard in the variable name e.g. ReverseProxy:Routes:*:Match:Hosts:0 so that I could just define this once? This is a reverse proxy service that will continue to have new services added and I'd need to add a line for this every time.
I couldn't find any documentation describing whether a wildcard in the variable name is allowed.

Related

Ansible: want to map dynamic hosts with instance-id's

My code : http://pastebin.com/jzrYTR2u
What I want to achieve: My script should dynamically take the hosts with specific tag and perform the above tasks on each host one by one. Currently, I am taking the instance-id from elb_facts module.
What I have achieved till now: My script will take the first instance out from elb, will perform the deploy tasks, add back to elb. hosts file is currently hardcoded with IPs
Use the boto api to make a connection with AWS and use filters to find the instances you want. You can then recursively search through the list to get the instances and then the instance id's. An example below to make the request for filtered instances:
filters = dict()
filters["tag:Profile"] = node["profile"]
filters["tag:Environment"] = environment
filters["availability_zone"] = region + node["distribution"][index]["zone"]
filters["tag:ServiceName"] = node['service_name']
instances_aws = aws_connection.get_all_instances(filters=filters)
Hope this helps

Using environment variable With Post/Session?

I'm using the environment variable $PMTargetName#numAffectedRow, but the TargetName is a parameter(parfile)
I'm trying to do this way:
$PM$$SOURCE_TABLE#NumAffectedRows
Is not working :/
What you need to use here is the name of the Target Transformation, not the table name. So assuming you've got a Target Transformation named MyTargetTable and you use the Target Table Name property to set the actual table name to e.g. Customers, then:
$PMMyTargetTable#TableName should give you Customers
and $PMMyTargetTable#NumAffectedRows should get you what you're looking for
The variables to be used in pre/post session commands need to be passed to the session from parameter file. e.g. $PMTargetName should be used in your session e.g. as Target Table Name. If you are doing this, then this will work - ${PMTargetName}#numAffectedRow. Adding parentheses will ensure your variable is expanded before #numAffectedRow is appended to it.
If you are not using $PMTargetName anywhere in your session then IS will not expand it. You should declare it as your workflow variable. And since you have already defined it in parameter file...rest should work.

Matching multiple DataItems using .getDataItems

I have data items stored with the path /item/<id>. I'm trying to get all current items stored in the network using Wearable.DataApi.getDataItems(GoogleApiClient, Uri), but passing in the uri with the /item/ path doesn't match anything. I've checked to make sure the hosts match up.
The Android Wear documentation says that:
if the host is elided, all data items matching that path are returned.
What does that mean?
Did you try Uri.parse("wear:/item")?
https://developer.android.com/reference/com/google/android/gms/wearable/DataApi.html

MVC 2 Routing - {Controller}.com/{action}/{id} - Is it Possible?

We have several different domains hosted on an in-house server. They all represent different brands owned by our company and we would like integration between each domain, sharing models, views, resources etc.
What I'd like to do is have {Controller} as the actual domain so it would look like http://{Controller}.com/{Action}/{Id}.
Is this possible? I've seen people do it with sub-domains.
AND, is it worthwhile or is there an easier way to accomplish the same.
If so, does anyone have any suggestions on how I can test this on Localhost?
Yes, it's possible and not all that different to routing based on sub-domains. If you look at this example, he looks at the Host header, splits on the '.' and then takes the first element in the array. You'll simply be taking the second-last element in that array (since "com" is the last element). Basically, in your GetRouteData override, you do something like this:
// Retrieve the url - and split by dots:
var url = httpContext.Request.Headers["HOST"];
var urlParts = url.Split(".");
var routeData = new RouteData(this, new MvcRouteHandler());
routeData.Values.Add("controller", urlParts[urlParts.Count - 2]);
(error-checking and validation not included here, obviously)
As for testing on localhost, you can simply add the domain names you want to test to your hosts file, pointing at 127.0.0.1.

Optional URL parameters with url routing in webforms

Playing with the new(ish) url rewriting functionality for web forms, but I'm running into trouble trying to declare parameters as optional.
Here's the scenario. I've got a search function which accepts two parameters, sku and name. Ideally I'd like the URL for this search function to be /products/search/skuSearchString/nameSearchString. I also have various management pages that need to map to things like /products/management/ or /products/summary/. In other words, the last two parameters in the URL need to be optional - there might be one search string, or two, or none.
This is how I've declared my virtual URL:
Friend Const _VIRTUALURL As String = "products/{action}/{sku}/{*product}"
And added the following defaults:
Me.Defaults = New Web.Routing.RouteValueDictionary(New With {.sku = "/"})
Me.Defaults = New Web.Routing.RouteValueDictionary(New With {.product = "/"})
I have two problems with this setup. The most pressing is that the url seems to expect an sku parameter. So, /products/summary/ cannot be found but /products/summary/anyTextAtAll/ maps to the correct page. You get the same result whether the defaults are set to "/" or "". How do I ensure both sku and product parameters are optional?
The second is more a matter of interest. Ideally, I'd like the url to be able to tell whether or not it's got a product search string or a url search string. The obvious way to do this is to make one or the other default to a value I can just pick up and ignore, but is there a neater way of handling it?
I'm not sure I entirely understood the question, but I have some comments about what you've shown so far:
The manner in which you're setting defaults seems incorrect. You're first setting a default value dictionary with a value for "sku". You're then replacing the default value dictionary with a value for "product".
A default value of "/" is unlikely to be what you want. In this case it sounds like you want a default value of just "" (empty string).
Try something like:
Me.Defaults = New Web.Routing.RouteValueDictionary(New With {
.sku = "",
.product = "" })
My VB skills are rather weak, so the syntax I showed might not be exactly right.
I think that if you change both of these then you should be good to go.

Resources