I am rewriting the logic of Kubernetes' NodeResourcesFit plugin, I want to use preFilterState like https://github.com/kubernetes/kubernetes/blob/419e0ec3d2512afd8c1f35a44862f856bc4ac10f/pkg/scheduler/framework/plugins/noderesources/fit.go#L91, so I import it in the code:
import "k8s.io/kubernetes/pkg/scheduler/framework/plugins/noderesources"
and use it just like:
s, ok := c.(*noderesources.preFilterState)
However I get an error: undefined: noderesources.preFilterState
I am not familiar with Kubernetes, so I don't know what is wrong with it. Thanks for your patience.
I try to print noderesources.Name but it failed too.
According to the link you're providing, preFilterState is not exported and therefore not accessible from the outside of the package.
It has nothing to do with Kubernetes but with go:
example: https://go.dev/tour/basics/3
doc: https://go.dev/doc/effective_go#names
I have a feeling you are starting with go, I recommend you play a bit with the fundamentals of the language and maybe use an IDE/Text editor with intellisense to be able to know what you can and cannot call.
Related
Just started learning how to use AWS Lambda to put my Python codes up and I've come across an issue that is making me question my sanity. In all videos, tutorials, and forums on the subject, people seem to have an entry field to modify the name of the lambda handler. This option appears nowhere on my lambda configuration page. My code does run if I use the default naming of a "lambda_function" file and a "lambda_handler" main function inside it, but nowhere do I see an option to specify my own names.
The reason I want to specify my own names is that I am trying to be able to import user-created modules and it seems the only way to do that is to modify the handler to specify a subfolder as documented here (just putting from modulename import function, class or whatever in the main handler_function file does not appear to work.
Thanks all for all the help !!
You can change your lambda handler name.
Configuration -> Basic setting -> Handler info
You can find below Tags
See this screenshot :
For latest update remove basic setting of lambda so follow this :
Click on layer as show below in image
Check Run time setting and edit it.
I wrote a small app returning routes with my public transport.
I'd like to package the app and use it via cli like: $ app_name start destination which is than handled by the app etc.
I've used the entry_points option in setup.py by defining an interface file, which is referenced when running the above code from command line.
However, I do not know if that's a best practice to accomplish that (as I have not found it on python.org.
So: What is a best practice to provide a cli?
An example I've seen:
with pytube you can do
$ pytube http://youtube.com/watch?v=9bZkp7q19f0 --itag=22
[EDIT:] thanks for the comments so far; they hint me to rephrase my question
I am trying to extend Sonarqube with custom Javascript rules. I find that the documentation is fairly limited on this subject. The extension tutorials on sonarqube website show only the most basic stuff.
The only javadoc I could find is this one: http://javadocs.sonarsource.org/latest/apidocs/ and it doesn't cover anything about extending Javascript.
What I ultimately want to do is add a JS rule that will check for hardcoded secrets (such as passwords, api keys, etc). I already created one for Java, and that was a lot easier as I could take an already pre-made plugin and complete it with my custom regex.
The problematic spot that made me post here was actually this one:
cannot find symbol
symbol: class VariableTree
location: package org.sonar.plugins.javascript.api.tree.expression
I was following the same scheme as with Java and used
import org.sonar.plugins.javascript.api.tree.expression.VariableTree;
which is obviously wrong. I was not able to find the source code for this either... if anybody can point me to some secret doc stash or at least where I can find a javadoc for org.sonar.plugins.javascript.api that would be amazing!
Thanks very much for any help
I try to use the package https://github.com/BlueBayTravel/Mailchimp as in examples but i got an error:
ErrorException in Mailchimp.php line 64:
Undefined property: BlueBayTravel\Mailchimp\Facades\Mailchimp::$users
when i try to use: Mailchimp::users(), while i can get a connection via Mailchimp::getDefaultConnection(); mean the package is completely red, what u guess the problem with me here ?
I saw that you already opened an issue in the package repo.
If you are using Laravel, and you want to use an existing integration with Mailchimp, I would recommend you to give a try to the spatie/laravel-newsletter package. It's the most complete package I've found for the integration Laravel + Mailchimp, and it uses the drewm/mailchimp-api API wrapper (which IMO, is the best php wrapper for Mailchimp). You can find some examples at Freek's blog or at the README file of the project. And if you do not find what you need, you can go to a lower level using the drewm wrapper: $api = Newsletter::getApi();
If this is not what you are looking for, you can always create your own service in Laravel, adapted to your needs and requierements ;)
I'm using the Check package to validate parameters passed to Meteor methods. And I'm using Audit argument checks to enforce this.
However, I've added another package, Meteor Tags and when I try to use methods from the Tags package, I get a server error "Exception while invoking method '/patterns/addTag' Error: Did not check() all arguments during call to '/patterns/addTag'".
I think I understand why this error happens - the method in the Tags package doesn't check its inputs, so Audit Argument Checks generates an error. But I can't find any way around this, apart from 1) don't enforce checking, or 2) hack the Tags package methods so they use check. Neither of these seems like a great option - checking server parameters is a good idea, and hacking a package is not very maintainable.
Does anybody know if there is any smart way to use 'Audit argument checks' with packages that provide new server methods? I have looked at the Check documents, and searched online, but I haven't found an answer.
I hope this question makes sense.
Using audit-argument-checks is like saying: "I want to be serious about the security of the methods in my app." It's global to all methods in your app's codebase, including the methods from your installed packages.
There is no way to specify which parts of the app get checked, as that would be the equivalent of saying: "I want to be serious about the security of the methods I've written, but I don't care about the security holes created by some pacakges" (which doesn't make a lot of sense).
Note to package authors
Check your method arguments. It's not hard, and it prevents this situation from happening. Frankly, a package without this basic security really shouldn't be installed in the first place.
What you should do
Unless you have a throwaway app, I wouldn't recommend removing audit-argument-checks. Instead I'd do the following (assuming the package really has something of value):
Open an issue on github and let the maintainer know what's up.
Fork the code, and add the required checks. Keep this version as a local package.
Submit a pull request for the changes.
If all goes well, your PR will be accepted and everyone can benefit from the change. In the worst case, you'll still have a local copy that you can use in your app.