Weblogic WLST get deployments status - weblogic12c

I am trying to get deployments status from Weblogic Scripting tool. By deployments I mean list of deployments shown in Weblogic server administration console - Domain structure - Deployments
I found that using:
cd ('AppDeployments')
print cmo.getAppDeployments()
I can get state of "some" app deployments (I found names of these apps in config.xml), but those are not from Weblogic server administration console. Can anybody suggest where I can get that list and it's current state ?

My script for listing apps :
connect('weblogic','welcome1','t3://127.0.0.1:7001')
cd('AppDeployments')
deplymentsList=cmo.getAppDeployments()
for app in deplymentsList:
domainConfig()
cd ('/AppDeployments/'+app.getName()+'/Targets')
mytargets = ls(returnMap='true')
domainRuntime()
cd('AppRuntimeStateRuntime')
cd('AppRuntimeStateRuntime')
for targetinst in mytargets:
curstate4=cmo.getCurrentState(app.getName(),targetinst)
print '----', app.getApplicationName(), ' | ', app.getVersionIdentifier(), ' | ', app.getModuleType(), ' | ', targetinst, ' | ', curstate4, ' | ', app.getSecurityDDModel(), ' | ', app.getAbsoluteSourcePath()
More scripts can be found at: https://github.com/devwebcl/wls_contraption/tree/master/wlst

Related

Airflow duplicated plugin entries in virtualenv

Was setting up Airflow (2.1.4) in a virtual environment followed by an install of a third-party plugin "pip install simple-dag-editor"
Plugin installed successfully, however upon checking the plugin list, there were duplicated entries.
(venv) root#test-server:/opt/airflow$ airflow plugins
name | source | flask_blueprints | appbuilder_views
==================+============================================================+=======================================================+=============================================================
simple_dag_editor | simple-dag-editor==0.1.1: | <flask.blueprints.Blueprint object at 0x7f69e5e427b8> | {'category': 'Admin', 'name': 'Simple DAG editor', 'view':
| EntryPoint(name='simple_dag_editor', value='simple_dag_edi | | <simple_dag_editor.app_builder_view.AppBuilderDagEditorView
| tor.simple_dag_editor:SimpleDagEditor', | | object at 0x7f69e5dd1470>}
| group='airflow.plugins') | |
simple_dag_editor | simple-dag-editor==0.1.1: | <flask.blueprints.Blueprint object at 0x7f69e5e427b8> | {'category': 'Admin', 'name': 'Simple DAG editor', 'view':
| EntryPoint(name='simple_dag_editor', value='simple_dag_edi | | <simple_dag_editor.app_builder_view.AppBuilderDagEditorView
| tor.simple_dag_editor:SimpleDagEditor', | | object at 0x7f69e5dd1470>}
| group='airflow.plugins') | |
Airflow portal also resulted in 2 entries in the "Admin" section
Any idea what is happening? I tested the setup again both on a docker container and standalone on the server. Both instances did not result in the duplicated entries therefore I am suspecting it is related to running Airflow in a Python virtual environment. The server is running on CentOS 7.
I believe you might have plugin installed twice in two different places:
In "plugins" folder as simply a python package
Installed as python package
Aiflow Allows for both types of installations, and I think if you have both - it will install both.
If you change the airflow log level to verbose, you should be able to see two entries:
"Loading plugins from entrypoints"
"Loading plugins from directory: <DIRECTORY>"
They should be followed by attempts to import the plugins.
The solution would be to remove the plugings from the "plugins" directory.
It's also possible that you have two packages that have the same entrypoint - for example if you installed it with different package name before, it could also be discovered twice. Airflow checks all pacakges available and if they have appropriate entrypoint declared, it will load it as plugin. But if you enable DEBUG logging level, you should see details. You can easily set airflow logging level by config option (or environment variable):
https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#logging-level

ng server command opens file open option menu

In VS code editor, ng serve command opening "How do you want to open this file?" dialog box in
The answer by Petr Freiberg helped get me to what I believe is a better solution. Instead of deleting files that may or may not actually be important for the system, we should update our PATH variables so that the "correct" command is found first.
In my situation, I had my npm paths in this order:
C:\Users\Me\AppData\Roaming\npm\node_modules\#angular\cli\bin
C:\Users\Me\AppData\Roaming\npm
I just switched the order so that C:\Users\Me\AppData\Roaming\npm came first.
The issue is that the terminal is finding the first "command match" which may just be a file, so that is why it is asking where you want to open it.
I did run the command Run Get-Command -All ng | ForEach-Object Path as Petr suggested, which called out the order issue I describe here.
I encountered a similar problem when executing a Docker command within Visual Studio Code. I also got a window asking "How do you want to open this file?". I think the problem is not in Visual Studio Code, but in PowerShell, which Visual Studio Code uses.
I solved it like this:
Run Get-Command -All docker | ForEach-Object Path
Among the file paths returned, remove those that do not end in *.exe (use
Remove-Item):
For ng it should be same.
Credits: https://stackoverflow.com/a/63981418/1816014
i have faced the same issue, while trying to run ng -v or ng --version, it pops open a Open option editor, which gives following ng.js text...
#!/usr/bin/env node
'use strict';
// Provide a title to the process in `ps`.
// Due to an obscure Mac bug, do not start this title with any symbol.
try {
process.title = 'ng ' + Array.from(process.argv).slice(2).join(' ');
} catch (_) {
// If an error happened above, use the most basic title.
process.title = 'ng';
}
// This node version check ensures that extremely old versions of node are not used.
// These may not support ES2015 features such as const/let/async/await/etc.
// These would then crash with a hard to diagnose error message.
// tslint:disable-next-line: no-var-keyword
var version = process.versions.node.split('.').map((part) => Number(part));
if (version[0] % 2 === 1 && version[0] > 14) {
// Allow new odd numbered releases with a warning (currently v15+)
console.warn(
'Node.js version ' +
process.version +
' detected.\n' +
'Odd numbered Node.js versions will not enter LTS status and should not be used for production.' +
' For more information, please see https://nodejs.org/en/about/releases/.',
);
require('../lib/init');
} else if (
version[0] < 12 ||
version[0] === 13 ||
(version[0] === 12 && version[1] < 14) ||
(version[0] === 14 && version[1] < 15)
) {
// Error and exit if less than 12.14 or 13.x or less than 14.15
console.error(
'Node.js version ' +
process.version +
' detected.\n' +
'The Angular CLI requires a minimum Node.js version of either v12.14 or v14.15.\n\n' +
'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n',
);
process.exitCode = 3;
} else {
require('../lib/init');
}
what is the error here, i tried uninstall clear cache and install but still same error....

In VB6, using the FilesSystemObject, how to access directories on multiple servers?

In a project we have a table with the following fields: FolderPath, FileType, DaysToKeep, ServerIP.
When the utility is executed, I read the rs from the table then want to access the [ServerIP]\[FolderPath] to see of the delta of Now() and the first file's (or a file's) last save date is greater than DaysToKeep.
I have most of the pseudo-code done and am confident in being able to do this on a local server using the FileSystemObject (importing Microsoft Scripting Runtime).
rsDirectoryList.MoveFirst
Do While Not rsDirectoryList.EOF
' Fields: FolderPath, FileType, DaysToKeep, ServerIP
Debug.Print "Values: " & rsDirectory.Fields("FolderPath").Value
' get directory contents from [ServerIP]:[FolderPath]
'fileSpec = rsDirectory.Fields("ServerIP") & rsDirectory.Fields("FolderPath")
Set f = fso.GetFile(fileSpec)
Debug.Print "Last Modified: " & f.DateLastModified & vbNewLine
' Get the date of the first file from [ServerIP]\[FolderPath]
' If Now() - FileDate in days > DaysToKeep, purge directory
'If DateDiff("d", Now(), f.DateLastModified) > rsDirectory.Fields("DaysToKeep").Value Then
' ' Delete files from specified directory
' Kill (serverIP \ FolderPath) ?????
'Else
' Debug.Print "Skipping: " & rsDirectory.Fields(0).Value & vbNewLine
'End If
rs1.MoveNext
Loop
I was thinking that I may have to create a share for each server on the utility's server and access them by drive letter, rather than by IP address.
Is there a way to do this with the given IP addresses?

Magento admin panel inaccessible with no error (after server hang)

the server that a magento install was on crashed for (currently reason unknown) and now the backend is inaccessible. I either get no error or I get access denied. I am able to preform the password reset.
I have tried:
clearing the browser cookies and cache
clearing the session, tmp and cache folders in magento
using the magento database repair tool - no errors were found
creating a new user manually in the admin_users table (this gets access denied)
rebooting the server again (last resort but still no)
The main admin user gets a redirect loop.
Any ideas are welcome, I am now stumped.
EDIT:I am really after any way to recover a magento admin login? or failing this any way to export the data (without exporting the bugged section)
I have employed a hack in one of the core magento files detailed here: http://blog.chapagain.com.np/magento-admin-login-problem/
I have had to comment out lines in "app/code/core/Mage/Core/Model/Session/Abstract/Varien.php":
(please note this is for 1.6 - check link posted for advice on 1.4)
$cookieParams = array(
'lifetime' => $cookie->getLifetime(),
'path' => $cookie->getPath()//,
//'domain' => $cookie->getConfigDomain(),
//'secure' => $cookie->isSecure(),
//'httponly' => $cookie->getHttponly()
);
also line 104 comment out :
//call_user_func_array('session_set_cookie_params', $cookieParams);
It seems to be when the server went down something happened to the session, as the new install also failed.
You can get your data by performing a database backup via cPanel or mysqldump via SSH access. Your hosting provider should be able to help you. Additionally, you can unzip the admin files from your Magento installed version. Download it to your computer and unzip the installation... then re-zip the folder for app/design/adminhtml ... upload and unpack this on your website in the proper place, and this will reinstall the PHP pages.
Double check the file app/etc/local.xml this usually has the database login stored in it.
Inside the mysql database for your magento installation, there is the table core_config_data and in it, some path values might interfere with using admin if intentionally set incorrectly:
mysql> select config_id, path, left(value,30) from core_config_data WHERE path LIKE '%admin%';
+-----------+-------------------------------------------+--------------------------------+
| config_id | path | left(value,30) |
+-----------+-------------------------------------------+--------------------------------+
| 50 | dev/translate_inline/active_admin | 0 |
| 220 | web/secure/use_in_adminhtml | 0 |
| 687 | admin/startup/page | catalog/products |
| 690 | admin/security/use_form_key | 0 |
| 691 | admin/security/use_case_sensitive_login | 1 |
| 692 | admin/security/session_cookie_lifetime | 36000 |
| 745 | admin/url/use_custom | 0 |
| 746 | admin/url/custom | |
+-----------+-------------------------------------------+--------------------------------+

How to programatically compare permissions of login/user in SQL Server 2005

There's a login/user in SQL Server who is having a problem importing accounts in production server. I don't have an idea what method he is doing this. According to the one importing, this import is working fine in development server. But when he did the same import in production it is giving him errors. Below are the errors he is getting for each accounts.
2009-06-05 18:01:05.8254 ERROR [engine-1038] Task [1038:00001 - Members]: Step 1.0 [<Insert step description>]: Task.RunStep(): StoreRow has failed
2009-06-05 18:01:05.9035 ERROR [engine-1038] Task [1038:00001 - Members]: Step 1.0 [<Insert step description>]: Task.RunStep(): StoreRow exception: Exception caught while storing Data. [Microsoft][ODBC SQL Server Driver][SQL Server]'ACCOUNT1' is not a valid login or you do not have permission.
Please note that 'ACCOUNT1' is not the real account name. I just changed it for security reason.
Using SQL Server Management Studio (SSMS), I viewed/checked the permissions of the user/login who is performing the import from development server and production for comparison. I found no difference.
My question is: Is there a way to programmatically query permissions in server and database level of a particular login/user so I can compare/contrast for any differences?
Red Gate's SQL Compare wil do it for you.
This code shows all the rights that the login has.
select sys.schemas.name 'Schema', sys.objects.name Object, sys.database_principals.name username, sys.database_permissions.type permissions_type,
sys.database_permissions.permission_name,
sys.database_permissions.state permission_state,
sys.database_permissions.state_desc,
state_desc + ' ' + permission_name + ' on ['+ sys.schemas.name + '].[' + sys.objects.name + '] to [' + sys.database_principals.name + ']' COLLATE LATIN1_General_CI_AS
from sys.database_permissions
join sys.objects on sys.database_permissions.major_id =
sys.objects.object_id
join sys.schemas on sys.objects.schema_id = sys.schemas.schema_id
join sys.database_principals on sys.database_permissions.grantee_principal_id =
sys.database_principals.principal_id
order by 1, 2, 3, 5
You should be able to use
sp_helplogins '<loginname>'
See the MSDN reference here.