You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have implemented a perl wrapper to make it easier to use pcs on RHEL9.1.
#!/usr/bin/perl
sub exec_command {
my ($command) = @_;
my $result;
my $exit_code;
$result = `$command`;
$exit_code = $? >> 8;
if ($exit_code != 0){
printf("ERROR\n");
}
return $result;
}
my $input = <STDIN>;
chomp $input;
if ($input !~ m/^y$/i) {
exit(0);
}
close STDIN;
exec_command("/usr/sbin/pcs cluster destroy --all --force");
The pcs command will generate an error if STDIN is closed on the perl side when executing wrap processing with confirmation processing such as the following.
[root@rh91-01 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux release 9.1 (Plow)
[root@rh91-01 ~]# pcs --version
0.11.3
[root@rh91-01 ~]# ./test.pl
y
Traceback (most recent call last):
File "/usr/sbin/pcs", line 33, in <module>
sys.exit(load_entry_point('pcs==0.11.3', 'console_scripts', 'pcs')())
File "/usr/lib/python3.9/site-packages/pcs/app.py", line 273, in main
routing.create_router(cmd_map, [])(
File "/usr/lib/python3.9/site-packages/pcs/cli/common/routing.py", line 33, in _router
return cmd_map[sub_cmd](lib, argv_next, modifiers)
File "/usr/lib/python3.9/site-packages/pcs/cli/common/routing.py", line 33, in _router
return cmd_map[sub_cmd](lib, argv_next, modifiers)
File "/usr/lib/python3.9/site-packages/pcs/cluster.py", line 1266, in cluster_destroy
if utils.is_run_interactive():
File "/usr/lib/python3.9/site-packages/pcs/utils.py", line 2059, in is_run_interactive
return sys.stdin.isatty() and sys.stdout.isatty()
AttributeError: 'NoneType' object has no attribute 'isatty'
ERROR
Conversely, if STDIN is not closed, the pcs command will not generate an error.
[root@rh91-01 ~]# ./test.pl
y
Warning: Unable to load CIB to get guest and remote nodes from it, those nodes will not be deconfigured.
rh91-02: Stopping Cluster (pacemaker)...
rh91-01: Stopping Cluster (pacemaker)...
rh91-02: Successfully destroyed cluster
rh91-01: Successfully destroyed cluster
[root@rh91-01 ~]#
I think that the process of closing STDIN used on the perl side is in the normal implementation.
It seems to be a problem of isatty processing on the pcs side, but is it possible to deal with it?
Best Regards,
Hideo Yamauchi.
The text was updated successfully, but these errors were encountered:
Thank you for reaching out. It seems you found a bug in pcs. Apparently, sys.stdin as well as sys.stdout and sys.stderrcan be None. We should update pcs to check if they are not None before we access their isatty method.
Thank you for reaching out. It seems you found a bug in pcs. Apparently, sys.stdin as well as sys.stdout and sys.stderrcan be None. We should update pcs to check if they are not None before we access their isatty method.
Thanks for your comment.
I understand that there is a problem with pcs.
For the time being, I will consider some kind of correspondence in the wrapping process.
Hi All
We have implemented a perl wrapper to make it easier to use pcs on RHEL9.1.
The pcs command will generate an error if STDIN is closed on the perl side when executing wrap processing with confirmation processing such as the following.
Conversely, if STDIN is not closed, the pcs command will not generate an error.
I think that the process of closing STDIN used on the perl side is in the normal implementation.
It seems to be a problem of isatty processing on the pcs side, but is it possible to deal with it?
Best Regards,
Hideo Yamauchi.
The text was updated successfully, but these errors were encountered: